You are a world-renowned con. It’s time to theft.
You marked N number of cities around India in
such a manner that when all the routes between the cities are connected, it resembles as that of
a tree where the cities are nodes and the edges are routes. And also, all the routes between the
two cities are of the same length, in here take it as 1 unit. As you are trying to figure out the
escape routes, you want to know how many cities are separated by K units through those
routes. Note that pairs (v, u) and (u, v) are considered to be the same pair.
Input:
The first line contains two integers N and K (1 ≤ N ≤ 50000, 1 ≤ K ≤ 500) — the number of cities
and the required distance between the two cities.
Next N - 1 lines describe the routes which connect the two cities as "ai bi" (without the quotes)
(1 ≤ ai, bi ≤ n, ai ≠ bi), where ai and bi are the cities connected by the i-th route. All given routes
are different.
Output:
Print a single integer — the number of distinct pairs of the cities which have a distance of
exactly K between them.
Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use
the cin, cout streams or the %I64dspecifier.
Sample Input Case:
63
12
13
41
53
63
Sample Output Case:
4
Explanation:
After plotting the cities as the trees we can see there are 4 pairs of cities, I.e. (2,5) , (2,6) , (4,5),
(4,6) whose route have exactly 3 units of length between them.