Score : $600$ points
Snuke has a die (singular of dice) that shows integers from $1$ through $N$ with equal probability, and an integer $1$.
He repeats the following operation while his integer is less than or equal to $M$.
Find the expected value of the number of times he rolls the die until he stops, modulo $10^9+7$.
Input is given from Standard Input in the following format:
$N$ $M$
Print the answer.
2 1
2
The answer is the expected value of the number of rolls until it shows $2$ for the first time. Thus, $2$ should be printed.
2 39
12
The answer is the expected value of the number of rolls until it shows $2$ six times. Thus, $12$ should be printed.
3 2
250000004
The answer is $\frac{9}{4}$. We have $4 \times 250000004 \equiv 9 \pmod{10^9+7}$, so $250000004$ should be printed.
Note that the answer should be printed modulo $\bf{10^9 + 7 = 1000000007}$.
2392 39239
984914531
1000000000 1000000000
776759630