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
Sample 1
Input
3 1
1 2 3
Output
4
Sample 2
Input
4 2
2 1 4 3
Output
4
Sample 3
Input
6 2
2 3 1 5 6 4
Output
10