Problem:
Balls and Boxes 10

Balls

Boxes

Any way

At most one ball

At least one ball

Distinguishable

Distinguishable

1

2

3

Indistinguishable

Distinguishable

4

5

6

Distinguishable

Indistinguishable

7

8

9

Indistinguishable

Indistinguishable

10

11

12

Problem

You have $n$ balls and $k$ boxes. You want to put these balls into the boxes.

Find the number of ways to put the balls under the following conditions:

Each ball is not distinguished from the other.

Each box is not distinguished from the other.

Each ball can go into only one box and no one remains outside of the boxes.

Each box can contain an arbitrary number of balls (including zero).

Note that you must print this count modulo $10^9+7$.

Input

$n$ $k$

The first line will contain two integers $n$ and $k$.

Output

Print the number of ways modulo $10^9+7$ in a line.

Constraints

$1 \le n \le 1000$

$1 \le k \le 1000$

Sample Input 1

5 3

Sample Output 1

5

Sample Input 2

10 5

Sample Output 2

30

Sample Input 3

100 100

Sample Output 3

190569292

Solution in Python3 (judge verdict: Accepted)

#Balls and Boxes 10
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n,k = map(int,readline().split())
mod = 10**9+7
#分割数
def partition(n,r): #P(n,r)
    dp = [[0]*(r+1) for _ in range(n+1)]
    dp[0][0] = 1
    for i in range(n+1):
        for j in range(1,r+1):
            if j-1 >= 0:
                dp[i][j] += dp[i][j-1]

            if i-j >= 0:
                dp[i][j] += dp[i-j][j]
            
            dp[i][j] %= mod
    
    return dp[n][r]

print(partition(n,k))