Suppose we have N balls and M bins to put them into. The number of outcomes for this can be found using \'stars and bars\' method https://brilliant.org/wiki/integer-equation