# Tree Distance
## Problem Statement
You are given a tree with $n$ vertices and a positive integer $k$. Your task is to find the number of distinct unordered pairs of vertices $(u, v)$ such that the distance between $u$ and $v$ is exactly $k$. That is, pairs $(u, v)$ and $(v, u)$ are considered identical.
The distance between two vertices in a tree is defined as the number of edges in the unique simple path connecting them.
## Input Format
- First line: two space-separated integers $n$ and $k$.
- $n$ ($1 \le n \le 10^5$) is the number of vertices in the tree.
- $k$ ($1 \le k \le 500$) is the target distance.
- Next $n-1$ lines: Each line contains two space-separated integers $u_i$ and $v_i$ ($1 \le u_i, v_i \le n$, $u_i \neq v_i$), representing an undirected edge between vertex $u_i$ and vertex $v_i$. It is guaranteed that the given edges form a valid tree structure.
## Output Format
Output a single integer on a new line: the total count of distinct unordered pairs of vertices $(u, v)$ such that their distance is exactly $k$.
## Sample Test Cases
### Sample Input 1
```
10 3
2 1
3 1
4 3
5 4
6 5
7 1
8 6
9 2
10 6
```
### Sample Output 1
```
8
```
## Constraints
- $1 \le n \le 10^5$
- $1 \le k \le 500$
- $1 \le u_i, v_i \le n$
- $u_i \neq v_i$
- The given edges form a valid tree.
- Time limit: 1 second
- Memory limit: 256 MB
## Explanation
For the given sample, with $n=10$ and $k=3$, there are $8$ distinct unordered pairs of vertices whose distance is exactly $3$. These pairs are: $(1, 4)$, $(1, 5)$, $(1, 6)$, $(2, 5)$, $(2, 8)$, $(3, 6)$, $(3, 8)$, and $(4, 7)$.
Loading problem statement...