#include #include using namespace std; using int64 = long long; const int64 MOD = 1e9 + 7; vector T[2010]; int64 dp[2010][2010][2]; int size[2010]; int N, K; int64 dfs(int v, int par) { size[v] = 1; dp[v][0][0] = dp[v][1][1] = 1; for (int to : T[v]) { if (to == par) continue; dfs(to, v); size[v] += size[to]; int num = size[v]; for (int k = num; k >= 0; k--) { for (int st = 0; st <= 1; st++) { if (k == 0 and st == 1) continue; int64 nxt = 0; for (int subk = 0; subk <= size[to]; subk++) { for (int subst = 0; subst <= 1; subst++) { if (st == 1 and subst == 0) continue; if (st == 1 and subk + 1 > k) continue; (nxt += dp[v][k - subk][st] * dp[to][subk][subst]) %= MOD; } } dp[v][k][st] = nxt; } } } return (dp[v][K][0] + dp[v][K][1]) % MOD; } int main() { cin >> N >> K; for (int i = 0; i < N - 1; i++) { int a, b; cin >> a >> b; T[a].push_back(b); T[b].push_back(a); } cout << dfs(0, -1) << endl; for (int st = 0; st <= 1; st++) { cerr << "st: " << st << " dp: " << dp[0][K][st] << endl; } return 0; }