#P6026. 餐馆

餐馆

Description

The restaurant offers nn signature dishes, numbered 1,2,,n1,2,\cdots,n.

One day, kk customers came to the restaurant, and they had not decided what to eat. So Xiao W gave them an idea: each person first randomly chooses a number rr from 1,2,,n1,2,\cdots,n with equal probability, then randomly chooses a number ll from 1,2,,r1,2,\cdots,r with equal probability. This person then orders all dishes with numbers between ll and rr (including ll and rr).

So the customers did as Xiao W said. After all customers finished ordering, Xiao W suddenly realized: no two people ordered the same dish, so he only needs to cook at most one portion of each dish. To prove how lucky he is, he found you, who studies programming, and asks you to help compute the probability that this situation happens.

Input Format

Two integers nn and kk, as described in the statement.

Output Format

Output one integer pp, which is the required probability modulo 109+710^9+7.

10 1

1
2 2

250000002

Hint

Explanation of the samples:
Sample 11: Because there is only one customer, no matter what happens, there cannot be two people ordering the same dish. Therefore, the required probability is 11.

Sample 22: For each customer, the probability of ordering only dish 11 is 12\dfrac12, the probability of ordering only dish 22 is 14\dfrac14, and the probability of ordering both dishes is 14\dfrac14. For the two people to not order any common dish, one must order only dish 11 and the other must order only dish 22. The probability is $\dfrac14\times\dfrac12+\dfrac12\times\dfrac14=\dfrac14$, which modulo 109+710^9+7 is 250000002250000002.


Hint: If you do not know how to take a rational number modulo, please see P2613.


Constraints:
For 10%10\% of the testdata, k=1k=1.
For another 10%10\% of the testdata, 1kn51\le k\le n\le5.
For another 20%20\% of the testdata, 1k31\le k\le3.
For another 30%30\% of the testdata, 1kn1031\le k\le n\le10^3.
For all testdata, 1kn1081\le k\le n\le 10^8.

Translated by ChatGPT 5