Distribute a number into a list of values as equal as possible whose sum is equal to that number

Python 2, 48 43 bytes

Returns 0 on error.

lambda m,n:m/n and[m/n]*(n-m%n)+m%n*[m/n+1]

Try it online!


41 bytes (with @xnor's trick)

Throws NameError on error.

lambda m,n:[m/n or _]*(n-m%n)+m%n*[m/n+1]

Try it online!


MATL, 7 bytes

:gie!Xs

When there is no solution the output is an array containing at least one zero, which is falsy in MATL.

Try it online!

Explanation

Consider inputs m = 10 and n = 4.

:      % Implicitly input m. Push [1 2 ... m]
       % STACK: [1 2 3 4 5 6 7 8 9 10]
g      % Logical: convert nonzeros to 1
       % STACK: [1 1 1 1 1 1 1 1 1 1]
i      % Input n
       % STACK: [1 1 1 1 1 1 1 1 1 1], 4
e      % Reshape into matrix with n rows, padding with zeros
       % STACK: [1 1 1;
                 1 1 1;
                 1 1 0;
                 1 1 0]
!      % Transpose
       % STACK: [1 1 1 1;
                 1 1 1 1;
                 1 1 0 0]
Xs     % Sum of each column. Implicitly display
       % STACK: [3 3 2 2]

Mathematica, 33 bytes

#>#2&&Last@IntegerPartitions@##1&

input

[63, 11]

output

{6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5}

outputs False when it's not solvable