n, k = map(int, input().split()) info = [list(map(int, input().split())) for i in range(n-1)] MOD = 10**9 + 7 tree = [[] for i in range(n)] for i in range(n-1): tree[info[i][0]].append(info[i][1]) tree[info[i][1]].append(info[i][0]) # dp[pos][j] := 頂点posを根とする部分木から、 # ちょうどj個の頂点を条件2に従って黒で塗る方法の数 dp = [[0]*(n+1) for i in range(n)] #0個の頂点を黒で塗る通り数は、それぞれの部分木に対して1通り for i in range(n): dp[i][0] = 1 def dfs(pos): cnt = 1 #部分木が葉のとき if all([visited[i] for i in tree[pos]]): dp[pos][cnt] = 1 return cnt #cnt = 1 #部分木が葉でないとき for child_pos in tree[pos]: if not visited[child_pos]: visited[child_pos] = True cnt_child = dfs(child_pos) tmp = [0]*(cnt + cnt_child + 1) for i in range(cnt+1): for j in range(cnt_child+1): 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][i] %= MOD dp[pos][cnt] = 1 return cnt visited = [False] * n visited[0] = True dfs(0) print(dp[0][k] % MOD)