A shop has n identical gumballs and k distinct labeled jars in a row. Count the number of ways to place all n gumballs into the jars, where any jar may hold from zero up to all of the gumballs. Two placements differ if some jar ends up with a different number of gumballs. Report the count modulo 1000000007.
A single line with two integers n and k.
A single integer: the number of distributions, modulo 1000000007.
Example 1
Input
3 2
Expected
4
Explanation
The 4 distributions of 3 gumballs into 2 jars are (0,3),(1,2),(2,1),(3,0).
Example 2
Input
5 1
Expected
1
Explanation
With one jar all 5 gumballs must go into it, so there is exactly one way.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →