161_D. Distance in Tree
A tree is a connected graph that doesn't contain any cycles.

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

You are given a tree with n vertices and a positive number k. Find the number of distinct pairs of the vertices which have a distance of exactly k between them. 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 vertices and the required distance between the vertices.

Next n - 1 lines describe the edges as "ai bi" (without the quotes) (1 ≤ ai, bi ≤ n, ai ≠ bi), where ai and bi are the vertices connected by the i-th edge. All given edges are different.

Output

Print a single integer — the number of distinct pairs of the tree's vertices 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 %I64d specifier.

Examples

Input

5 2
1 2
2 3
3 4
2 5


Output

4


Input

5 3
1 2
2 3
3 4
4 5


Output

2

Note

In the first sample the pairs of vertexes at distance 2 from each other are (1, 3), (1, 5), (3, 5) and (2, 4).
```python

###pyrival template for fast IO
import os
import sys
from io import BytesIO, IOBase
# region fastio
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")


##make the tree
n,k=[int(x) for x in input().split()]
if n==1:
    print(0)
else:
    tree={1:[]}
    for i in range(n-1):
        a,b=[int(x) for x in input().split()]
        if a not in tree:
            tree[a]=[b]
        else:
            tree[a].append(b)
        if b not in tree:
            tree[b]=[a]
        else:
            tree[b].append(a)


    def dfs(graph,n,currnode):
        visited=[False for x in range(n+1)]
        stack=[currnode]
        index=[0 for x in range(n+1)]
        parent=[0 for x in range(n+1)]
        while stack:
            currnode=stack[-1]
            if visited[currnode]==False:
                visited[currnode]=True
            for i in range(index[currnode],len(graph[currnode])):
                neighbour=graph[currnode][i]
                if visited[neighbour]==False:
                    visited[neighbour]=True
                    stack.append(neighbour)
                    parent[neighbour]=currnode
                    index[currnode]+=1
                    break
            else:
                for i in range(k+2):
                    d[parent[currnode]][i+1]+=d[currnode][i]
                stack.pop()
        ans[1]=d[1][k]
        return
    d=[[0 for x in range(k+3)] for x in range(n+1)]
    for i in range(1,n+1):
        d[i][0]=1
    ans=[0 for x in range(n+1)]
    dfs(tree,n,1)
    def dfs1(graph,n,currnode):
        visited=[False for x in range(n+1)]
        stack=[currnode]
        index=[0 for x in range(n+1)]
        parent=[0 for x in range(n+1)]
        while stack:
            currnode=stack[-1]
            if visited[currnode]==False:
                visited[currnode]=True

            for i in range(index[currnode],len(graph[currnode])):
                neighbour=graph[currnode][i]
                if visited[neighbour]==False:
                    visited[neighbour]=True
                    stack.append(neighbour)
                    parent[neighbour]=currnode
                    index[currnode]+=1
                    for i in range(k+2):
                        d[currnode][i+1]-=d[neighbour][i]
                    for i in range(k+2):
                        d[neighbour][i+1]+=d[currnode][i]

                    ans[neighbour]=d[neighbour][k]

                    break
            else:
                for i in range(k+2):
                    d[currnode][i+1]-=d[parent[currnode]][i]
                for i in range(k+2):
                    d[parent[currnode]][i+1]+=d[currnode][i]
                stack.pop()
        return
    dfs1(tree,n,1)
    print(sum(ans[1:])//2)

```