#include using namespace std; #define repl(i, l, r) for (ll i = (l); i < (r); i++) #define rep(i, n) repl(i, 0, n) #define CST(x) cout << fixed << setprecision(x) using ll = long long; constexpr ll MOD = 1000000007; constexpr int inf = 1e9 + 10; constexpr ll INF = (ll)4e18 + 10; constexpr int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0}; constexpr int dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0}; template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(false); int n, k; cin >> n >> k; vector> G(n); rep(i, n - 1) { int a, b; cin >> a >> b; G[a].push_back(b); G[b].push_back(a); } vector s(n); vector> dp(n, vector(n + 1, 0LL)); auto dfs = [&](auto self, int v, int pre) -> void { dp[v][0] = 1; s[v] = 1; for (auto nv : G[v]) { if (nv == pre) continue; self(self, nv, v); vector ndp(n + 1, 0LL); rep(i, n - s[nv] + 1) { rep(j, s[nv] + 1) { if (dp[v][i] and dp[nv][j]) ndp[i + j] = (ndp[i + j] + dp[v][i] * dp[nv][j] % MOD) % MOD; } } dp[v] = ndp; s[v] += s[nv]; } dp[v][s[v]]++; }; dfs(dfs, 0, -1); cout << dp[0][k] << endl; return 0; }