Bob's School is installing security cameras to monitor its classrooms. There are classrooms, conveniently numbered from
to
(
), connected by
bidirectional hallways. Each hallway connects exactly two classrooms, and the network of hallways forms a tree (i.e., it is connected and acyclic). This means it is possible to reach any room from any other room via the hallways.
Security cameras can only be installed inside classrooms. A security camera installed in room can monitor all adjacent rooms (i.e., those directly connected to room
by a hallway), but it cannot monitor room
itself, as it is too close to the camera's focal range.
Additionally, no two cameras are installed in the same room. The school wants to install exactly cameras (
). Bob wants to know: how many different ways he can choose exactly
rooms to install cameras such that every classroom is monitored.
Can you help him count the number of valid configurations?
Input Specification
The first line contains two integers (
) and
(
), the number of rooms and the number of cameras.
Each of the following lines contains two integers
and
(
), indicating a hallway between room
and room
.
Output Specifcation
Output one integer, the number of different ways modulo .
Constraints
Subtask | Points | Additional constraints |
---|---|---|
The number of adjacent rooms to each room is at most | ||
No additional constraints. |
Sample Input 1
5 3
1 2
2 3
3 4
4 5
Sample Output 1
1
Explanation for Sample 1
The cameras must be installed at room
,
and
to cover all rooms. There is only one way.
Sample Input 2
8 4
1 2
1 3
2 4
2 5
2 6
5 7
5 8
Sample Output 2
5
Comments