Distance in Tree#633

Distance in Tree

2 seconds
256 megabytes
Medium (≈1350)

A connected graph without cycles is called a tree.

The distance between two vertices of a tree is defined as the length (in edges) of the shortest path between these vertices.

Given a tree with vertices and a positive integer . Compute the number of distinct pairs of vertices of the tree whose distance is equal to . Note that pairs and are considered the same pair.

Input

The first line contains two integers and k~(1 \le n \le 50000, 1 \le k \le 500) — the number of vertices in the tree and the required distance between vertices.

The next n - 1 lines contain the edges of the tree in the format a_i~b_i~(1 \le a_i, b_i \le n, a_i \neq b_i), where a_i and b_i are the vertices of the tree connected by the -th edge. All specified edges are different.

Output

Print a single integer — the number of distinct pairs of tree vertices whose distance is equal to .

Examples

Example 1

Loading
Loading