#P17017. [GESP202606 八级] 堆石子

[GESP202606 八级] 堆石子

Problem Description

There are mm piles of stones, numbered 1,2,,m1, 2, \cdots, m, and the number of stones in each pile is denoted by a1,a2,,ama_1, a_2, \cdots, a_m, respectively.

Now we require that the 11st pile has exactly nn stones (that is, a1=na_1 = n), and that for every pile after that, the number of stones is strictly less than the previous pile, i.e. ai<ai1a_i < a_{i-1} (2im2 \le i \le m). In addition, each pile must contain at least one stone, i.e. ai1a_i \ge 1 (1im1 \le i \le m).

With no restriction on the total number of stones, given m2m \ge 2 and n1n \ge 1, how many stone-piling configurations satisfy the requirements?

Two configurations are different if and only if there exists at least one pile whose number of stones is different between the two configurations.

If no configuration satisfies the requirements, output 00. Since the number of configurations may be very large, output the result modulo 109+710^9 + 7.

Input Format

Input one line containing two positive integers mm and nn.

Output Format

Output one integer, representing the total number of configurations modulo 109+710^9 + 7.

3 5
6

Hint

Sample Explanation 1

There are a total of 66 configurations: (5,4,3)(5, 4, 3), (5,4,2)(5, 4, 2), (5,4,1)(5, 4, 1), (5,3,2)(5, 3, 2), (5,3,1)(5, 3, 1), and (5,2,1)(5, 2, 1).

Constraints

::cute-table{tuack}

Test Point ID Constraints Special Properties
1,21,2 2m100,1n1002 \le m \le 100, 1 \le n \le 100 0nm50 \le n - m \le 5
3,4,53,4,5 2m100,1n1082 \le m \le 100, 1 \le n \le 10^8 None
6,7,8,9,106,7,8,9,10 2m105,1n1082 \le m \le 10^5, 1 \le n \le 10^8 ^

Translated by ChatGPT 5