Distribute a number into a list of values as equal as possible whose sum is equal to that number Probably a simple code-golf challenge. Given 2 positive integers m and n, make a list of n values that are positive integers whose sum is equal to the number m. Either all values in the output are the same value or the difference is exactly 1.

Examples

For example


m=6 and n=3 would become 2, 2, 2
m=7 and n=3 would become 2, 2, 3 or 2, 3, 2 or  3, 2, 2
m=7 and n=2 would become 3, 4 or 4, 3
m=7 and n=1 would become 7
m=7 and n=8 would generate an error because the sum of 8 positive integers cannot be 7.
m=10 and n=4 would become 3, 3, 2, 2 or any other permutation


Rules


Both input and output is only about positive integers.
Either all values in the output are the same value or the difference is exactly 1.
The order of the values in the list is not important.
The sum of the values in the list is equal to m.
When it's not solvable, generate an error or a false value (in case of m=7 and n=8 for example).
As a result of the other rules m=8 and n=3 would generate any of the permutations of 3, 3, 2 (not 2, 2, 4)


The winner

This is code-golf, so the shortest valid answer – measured in bytes – wins.
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!