P23658 [AtCoder] Survival Game
普及+
题目描述

Problem Description

Punch-kun's company is wildly popular for its survival games.

While regular survival games have only 2 teams, Punch-kun has grown tired of the usual setup and decided to have many teams compete against each other.

Given the number of participants and the number of teams, determine how many ways the teams can be divided.

Each participant must belong to exactly one team, and no team can have zero members.

Input Format

The input is given from the standard input in the following format:

$ N $ $ M $

  • The number of participants $N\ (2\ ≦\ N\ ≦\ 1000)$ and the number of teams $M\ (2\ ≦\ M\ ≦\ N)$ are given.

Output Format

Output the number of ways to divide the teams modulo $1000000007(\ =\ 1,000,000,007)$. Include a newline at the end of the output.

Sample Input and Output

Sample Input #1

2 2

Sample Output #1

1

Sample Input #2

3 2

Sample Output #2

3

Sample Input #3

500 2

Sample Output #3

695241506

Sample Input #4

20 10

Sample Output #4

584923236

Notes/Hints

Partial Points

If you correctly solve the test cases where $M\ =\ 2$, you will be awarded 40 points as partial credit.

Sample Explanation 1

There is only 1 way to divide 2 participants into 2 teams.

Sample Explanation 2

There are 3 ways to divide 3 participants into 2 teams:
- { $A,\ B$ }, { $ C $ }
- { $A,\ C$ }, { $ B $ }
- { $ A $ }, { $B,\ C$ }

Note that participants are distinguishable, but teams are not. { $A,\ B$ }, { $ C $ } and { $ C $ }, { $A,\ B$ } are counted as the same.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 2
样例输出
1