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!