cho.sh
Notes
Loading...

Restricted Permutations

Time limit

2s

Memory limit

128 MB

Problem

A permutation of length N is an arrangement that uses each integer from 1 through N exactly once. There are N! = N × (N - 1) × ... × 2 × 1 such permutations.

For a permutation P, let P[i] be its i-th element. Count the permutations P such that |P[i] - i| <= K for every 1 <= i <= N.

Input

The first line contains two positive integers N and K separated by a space. N is at most 100, and K is at most 6.

Output

Print the number of permutations that satisfy the condition.