#include "bits/stdc++.h" using namespace std; vector es[3000]; long long dp[3000][3000]; int child[3000]; long long mod = 1000000007; int main() { int N, K; cin >> N >> K; for (int i = 0; i < N - 1; i++) { int a, b; cin >> a >> b; es[a].push_back(b); } for (int i = N - 1; i >= 0; i--) { child[i] = 1; dp[i][0] = 1; for (auto j : es[i]){ for (int k = child[i] - 1; k >= 0; k--) { for (int l = child[j]; l >= 1; l--) { dp[i][k + l] += dp[i][k] * dp[j][l]; dp[i][k + l] %= mod; } } child[i] += child[j]; } dp[i][child[i]] = 1; } cout << dp[0][K] % mod << endl; cin >> N; }