Now you are given integer P and a tree with N nodes(rank them from 1 to N), I wonder how many way to assign the nodes weight so that to construct a Ptree.
The first line contains two integers N and P.(1 <= N <= 1,000, 1 <= P <= 1,000,000)
The Next N - 1 lines each line contains two integers x and y, indicating there is an edge between node x and node y.
Output the answer moduled 1,000,000,007(1e9+7)。
No tag edit access