#include using namespace std; #define REP(i,n) for (int i = 0; i < (n); ++i) #define FOR(i,a,b) for (int i = (a); i <= (b); ++i) #define FORD(i,a,b) for (int i = (a); i >= (b); --i) #define maxN 205 #define MOD 1000000007 int N, K; vector sons[maxN]; long long DP[maxN][maxN][2][2]; long long prev_all[maxN + 1]; void clear_all(long long *A) { REP(i, K + 1) A[i] = 0; A[0] = 1; } // all *= B void multiply(long long *A, long long *B) { REP(i, K + 1) prev_all[i] = A[i]; REP(i, K + 1) { A[i] = 0; REP(j, i + 1) { A[i] += (prev_all[j] * B[i-j]) % MOD; if (A[i] >= MOD) A[i] -= MOD; } } } long long dfs(int u, int val, int father_used, int root_used, int from); void dfs2(int u, int father_used, int root_used, int from) { long long all[maxN + 1]; long long b[maxN + 1]; clear_all(all); if (root_used == 0) { REP(i, (int)sons[u].size()) { if (sons[u][i] == from) continue; REP(k, K + 1) { b[k] = (dfs(sons[u][i], k, 0, 0, u) + dfs(sons[u][i], k-1, 0, 1, u)) % MOD; } multiply(all, b); } REP(i, K + 1) { DP[u][i][father_used][root_used] = all[i]; // printf("u %d i %d father_used %d root_used %d from %d: %lld\n", u, i, father_used, root_used, from, DP[u][i][father_used][root_used]); } return; } long long nobody_used[maxN]; REP(i, K + 1) nobody_used[i] = 0; if (father_used == 0) { nobody_used[0] = 1; REP(i, (int)sons[u].size()) { if (sons[u][i] == from) continue; REP(k, K + 1) { b[k] = dfs(sons[u][i], k, 0, 0, u); } multiply(nobody_used, b); } } REP(i, (int)sons[u].size()) { if (sons[u][i] == from) continue; REP(k, K + 1) { b[k] = (dfs(sons[u][i], k, 1, 0, u) + dfs(sons[u][i], k-1, 1, 1, u)) % MOD; } multiply(all, b); } REP(i, K + 1) { DP[u][i][father_used][root_used] = (all[i] - nobody_used[i] + MOD) % MOD; // printf("u %d i %d father_used %d root_used %d from %d: %lld\n", u, i, father_used, root_used, from, DP[u][i][father_used][root_used]); } } long long dfs3(int u, int val, int father_used, int root_used, int from) { if (!(father_used == 0 && root_used == 1) && val == 0) return 1; if (root_used == 0) father_used = 0; if (DP[u][val][father_used][root_used] >= 0) return DP[u][val][father_used][root_used]; if (val < 0) return 0; if (sons[u].size() == 1 && sons[u][0] == from) { return 0; } if (root_used == 0 && val == 1) return 0; dfs2(u, father_used, root_used, from); return DP[u][val][father_used][root_used]; } long long dfs(int u, int val, int father_used, int root_used, int from) { long long v = dfs3(u, val, father_used, root_used, from); // printf("u %d val %d father_used %d root_used %d from %d: %lld\n", u, val, father_used, root_used, from, v); return v; } int main() { while (scanf("%d%d", &N, &K) == 2) { REP(i, N+1) REP(j, K + 1) REP(k, 2) REP(l, 2) DP[i][j][k][l] = -1; REP(i, N+1) sons[i].clear(); REP(i, N-1) { int x,y; scanf("%d%d", &x, &y); sons[x].push_back(y); sons[y].push_back(x); } printf("%d\n", (int)((dfs(1, K, 0, 0, -1) + dfs(1, K - 1, 0, 1, -1)) % MOD)); // printf("\n\n"); } return 0; }