#agc005d. [agc005_d]~K Perm Counting
[agc005_d]~K Perm Counting
Problem Statement
Snuke loves permutations. He is making a permutation of length .
Since he hates the integer , his permutation will satisfy the following:
- Let the permutation be . For each , .
Among the permutations of length , how many satisfies this condition?
Since the answer may be extremely large, find the answer modulo (prime).
Constraints
Input
The input is given from Standard Input in the following format:
Output
Print the answer modulo .
Sample Input 1
3 1
Sample Output 1
2
permutations , satisfy the condition.
Sample Input 2
4 1
Sample Output 2
5
permutations , , , , satisfy the condition.
Sample Input 3
4 2
Sample Output 3
9
Sample Input 4
4 3
Sample Output 4
14
Sample Input 5
425 48
Sample Output 5
756765083