#include #define rep(i,n,m) for(int i = (n); i <(m); i++) #define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--) using namespace std; using ll = long long; const int MAX_N = 2002; const ll MOD = 1000000007; vector graph[MAX_N]; ll dp[MAX_N][MAX_N]; int num[MAX_N]; int k; void dfs(int root, int par) { dp[root][0] = 1; // dp[root][1] = 1; num[root] = 1; for (auto ch: graph[root]) if (ch != par) { dfs(ch, root); vector dp_now(MAX_N, 0); rep(i, 0, num[ch]+1) { rep(j, 0, num[root]+1) { if (i+j > k) break; dp_now[i+j] += dp[root][j] * dp[ch][i]; dp_now[i+j] %= MOD; // cout << root << ' ' << i << ' ' << j << " : "<< dp[root][j] << ' ' << dp[ch][i] << endl; } } num[root] += num[ch]; rep(i, 0, MAX_N) dp[root][i] = dp_now[i]; } dp[root][num[root]] = 1; // cout << root << ' ' << dp[root][0] << ' ' << dp[root][1] << endl; } int main() { int n; cin >> n >> k; rep(i, 0, n-1) { int a, b; cin >> a >> b; // --a, --b; graph[a].push_back(b); graph[b].push_back(a); } dfs(0, -1); cout << dp[0][k] << endl; return 0; }