#arc148e. [arc148_e]≥ K
[arc148_e]≥ K
Problem Statement
You are given a sequence of length , , and an integer .
How many permutations of are there such that no two adjacent elements sum to less than ? Find the count modulo .
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
4 5
1 2 3 4
Sample Output 1
4
The following four permutations satisfy the condition:
Sample Input 2
4 3
1 2 3 3
Sample Output 2
12
There are permutations of , all of which satisfy the condition.
Sample Input 3
10 7
3 1 4 1 5 9 2 6 5 3
Sample Output 3
108