Mirko found
Mirko decided that he will choose some boxes in a way that there is at least one toy of each kind present, and throw the rest of the boxes away.
Determine the number of ways in which Mirko can do this.
Input Specification
The first line of input contains two integers
Output Specification
The first and only line of output should contain the requested number of ways modulo
Scoring
In test cases worth 50% of total points,
In test cases worth 70% of total points,
Sample Input 1
3 3
3 1 2 3
3 1 2 3
3 1 2 3
Sample Output 1
7
Sample Input 2
3 3
1 1
1 2
1 3
Sample Output 2
1
Sample Input 3
4 5
2 2 3
2 1 2
4 1 2 3 5
4 1 2 4 5
Sample Output 3
6
Comments
Exactly the same as https://codeforces.com/problemset/problem/449/D