#include "bits/stdc++.h" using namespace std; #define rep(i,n) for(int i=0;i PI; typedef vector VI; const LL MOD = 1000000007LL; vector G[2000]; LL dp[2000][2001]; int tree[2000]; int N, K; void cnt(int v, int par) { tree[v] = 1; rep(i, G[v].size()) { int to = G[v][i]; if (to == par) continue; cnt(to, v); tree[v] += tree[to]; } } void dfs(int v, int par) { dp[v][0] = 1; rep(i, G[v].size()) { int to = G[v][i]; if (to == par) continue; dfs(to, v); for (int j = min(K,tree[v]); j >= 1; j--) { for (int k = 1; k <= j; k++) { LL t = (dp[v][j - k] * dp[to][k]) % MOD; (dp[v][j] += t) %= MOD; } } } (dp[v][tree[v]] += 1) %= MOD; } int main() { cin >> N >> K; rep(i, N - 1) { int a, b; cin >> a >> b; G[a].push_back(b); G[b].push_back(a); } cnt(0, -1); dfs(0, -1); cout << dp[0][K] << endl; }