Permutation counting - MarisaOJ: Marisa Online Judge

Permutation counting

Time limit: 1000 ms
Memory limit: 256 MB
Count the number of permutations of integers from $1$ to $n$ that $|p_i-i| \le m$. ### Input - A single line contains two integers $n,k$. ### Output - Print the number of permutations modulo $10^9+7$. ### Constraints - $1 \le n \le 1000$. - $1 \le k \le 6$. ### Example Input: ``` 4 2 ``` Output: ``` 14 ```