#abc199e. [abc199_e]Permutation
[abc199_e]Permutation
Problem Statement
Print the number of sequences that are permutations of and satisfy the following condition:
- for every integer such that , at most numbers among are less than or equal to .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3 1
2 2 1
Sample Output 1
4
The four sequences satisfying the condition are:
and violate the condition, since each of them has two numbers less than or equal to among .
Sample Input 2
5 2
3 3 2
4 4 3
Sample Output 2
90
Sample Input 3
18 0
Sample Output 3
6402373705728000