Count of Array
You love array, don't you?
You are given two integer and , along with an array of length containing pairwise distinct integers. You have to find the number of array of length satisfying the follow conditions:
- .
- for all .
- for all .
Since the answer can be very large, output it under modulo .
Input Format
- The first line of the input contains two space-separated integers and .
- The second line of the input contains separated integers - the array .
Output Format
Output on a single line the number of satisfactory array modulo .
Constraints
- for all .
Sample Input 1
3 4
5 1 2
Sample Output 1
14
Explanation
All satisfactory arrays are:
Sample Input 2
2 2
1 3
Sample Output 2
1
Explanation
The only satisfactory array is:
Comments
Post a Comment