""" mod で場合分け →使える数字の数が変わる 使える数字がX種類の時 数字の付け方を 2 <= X <= N の範囲で求めればいい? 1<=p<=Cの制約の影響を受けない範囲は省いてdp """ from sys import stdin import sys sys.setrecursionlimit(20000) def dfs(v,p,num): if memo[v][num] != None: return memo[v][num] ret = 1 for nex in lis[v]: tmp = 0 if nex != p: if num+1 < c: tmp += dfs(nex,v,num+1) if num-1 >= 0: tmp += dfs(nex,v,num-1) ret *= tmp ret %= mod memo[v][num] = ret return ret N,C = map(int,stdin.readline().split()) lis = [ [] for i in range(N) ] for i in range(N-1): a,b = map(int,stdin.readline().split()) a -= 1 b -= 1 lis[a].append(b) lis[b].append(a) #mod 0 mod = 10**9+7 ans = 0 c = C//3 if c < 4*N: memo = [ [None] * c for i in range(N) ] for i in range(c): ans += dfs(0,0,i) else: memo = [ [None] * (2*N) for i in range(N) ] for i in range(N): ans += dfs(0,0,i) * 2 ans += pow(2,N-1,mod) * (c-2*N) c = (C+2)//3 if c < 4*N: memo = [ [None] * c for i in range(N) ] for i in range(c): ans += dfs(0,0,i) else: memo = [ [None] * (2*N) for i in range(N) ] for i in range(N): ans += dfs(0,0,i) * 2 ans += pow(2,N-1,mod) * (c-2*N) c = (C+1)//3 if c < 4*N: memo = [ [None] * c for i in range(N) ] for i in range(c): ans += dfs(0,0,i) else: memo = [ [None] * (2*N) for i in range(N) ] for i in range(N): ans += dfs(0,0,i) * 2 ans += pow(2,N-1,mod) * (c-2*N) print (ans % mod)