#abc303h. [abc303_h]Constrained Tree Degree
[abc303_h]Constrained Tree Degree
Problem Statement
You are given an integer and a set consisting of integers between and .
Find the number, modulo , of trees with vertices numbered through such that:
- for all , where is the degree of vertex in .
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the number, modulo , of the conforming trees .
Sample Input 1
4 2
1 3
Sample Output 1
4
A tree satisfies the condition if the degree of one vertex is and the others' are . Thus, the answer is .
Sample Input 2
10 5
1 2 3 5 6
Sample Output 2
68521950
Sample Input 3
100 5
1 2 3 14 15
Sample Output 3
888770956
Print the count modulo .