You are given positive integers , , and a permutation of .
Compute the number of ordered -tuples of permutations of satisfying all of the following conditions, modulo .
- For every , .
- For every , .
Composition of permutations is defined as function composition. That is, for two permutations , we have .
Input
The input is given in the following format.
Here, denotes the value of .
Output
Print the number of ordered -tuples satisfying the conditions, modulo .
Constraints
- .
- .
- is a permutation of .
Subtasks
Samples
예제 1
입력
3 1
1 2 3
출력
4
Here is the identity permutation and . The possible choices for are the identity permutation and the three transpositions.
예제 2
입력
4 2
2 1 4 3
출력
4
There are ordered pairs satisfying the conditions.
예제 3
입력
6 2
2 3 1 5 6 4
출력
10