I need a function that creates a table of all possible lists of length $n$ which contain integer entries that sum up to the same given number $m$. For example, if we consider lists of size $n=3$ and want to distribute the number $m=2$ in them the result should be:
n=3;
m=2;
numberDistribute[n,m]
{{2,0,0},{0,2,0},{0,0,2},{1,1,0},{1,0,1},{0,1,1}}
Is there such a function in Mathematica? Or maybe there is a convenient way to write it? Thanks for any suggestion.