n, k = map(int, input().split()) info = [list(map(int, input().split())) for i in range(n-1)] tree = [[] for i in range(n)] for i in range(n-1): tree[info[i][0]].append(info[i][1]) dp = [[0]*(n+1) for i in range(n)] #すべて白色で塗る通り数は、それぞれの部分木に対して1通り for i in range(n): dp[i][0] = 1 def dfs(pos): cnt = 1 #部分木が葉のとき if not tree[pos]: dp[pos][cnt] = 1 return cnt #cnt = 1 for child_pos in tree[pos]: cnt_child = dfs(child_pos) tmp = [0]*(n+1) for i in range(cnt+1): for j in range(cnt_child+1): if i+j >= n+1: break tmp[i+j] += dp[pos][i]*dp[child_pos][j] cnt += cnt_child for i in range(cnt+1): dp[pos][i] = tmp[i] dp[pos][cnt] = 1 return cnt dfs(0) print(dp[0][k])