#include using namespace std; const int mod = 1000000007; int N, K; vector< int > graph[2000]; int dp[2000][2001]; int size[2000]; // SubTreeSize int dfs(int idx, int prev) { size[idx] = 1; for(int i = 0; i < graph[idx].size(); i++) { if(graph[idx][i] == prev) continue; size[idx] += dfs(graph[idx][i], idx); } return(size[idx]); } int rec(int idx, int prev, int mul) { if(~dp[idx][mul]) return(dp[idx][mul]); int* dp2 = dp[idx]; for(int i = 0; i <= K; i++) dp2[i] = 0; dp2[0] = 1; for(int i = 0; i < graph[idx].size(); i++) { if(graph[idx][i] == prev) continue; for(int j = K - 1; j >= 0; j--) { if(dp2[j] == 0) continue; for(int k = K - j; k > 0; k--) { (dp2[j + k] += dp2[j] * rec(graph[idx][i], idx, k)) %= mod; } } } (dp2[size[idx]] += 1) %= mod; return(dp2[mul]); } int main() { fill_n(*dp, 2000 * 2001, -1); cin >> N >> K; for(int i = 0; i < N - 1; i++) { int a, b; cin >> a >> b; graph[a].push_back(b); graph[b].push_back(a); } dfs(0, -1); cout << rec(0, -1, K) << endl; }