~/algor $ cat problems/kombinatorika-aynan-k-joyida
Exactly k in place
Medium
1000 ms
128 MB
60%
In a permutation of the numbers $1, 2, \dots, n$, the $i$-th element is said to stay in its place if $p_{i} = i$. How many permutations have exactly $k$ elements in their places? Print the answer modulo $10^{9} + 7$.
Input
One line with two integers: $n$ and $k$.
Output
One integer — the number of permutations modulo $10^{9} + 7$.
Note
$1 \le n \le 10^{6}$
$0 \le k \le n$
Examples
Input #1
4 2
Output #1
6
Input #2
3 2
Output #2
0