#include using namespace std; constexpr int md = 1e9 + 7; inline void mad (int &a, int b) { a += b; if (a >= md) a -= md; } inline int mul (int a, int b) { return (int)((long long)a * b % md); } auto convolution ( vector a, vector b ) -> vector { int l = a.size(); int m = b.size(); int n = l + m - 1; assert(l && m); vector c(n, 0); for (int i = 0; i < l; i++) { for (int j = 0; j < m; j++) { mad(c[i + j], mul(a[i], b[j])); } } return c; } void dfs ( vector>& grh, vector& sz, vector>& dp, int crr = 0, int prt = 0 ) { for (const int nxt : grh[crr]) if (nxt != prt) { dfs(grh, sz, dp, nxt, crr); sz[crr] += sz[nxt]; } dp[crr] = {1}; for (const int nxt : grh[crr]) if (nxt != prt) { dp[crr] = convolution(dp[crr], dp[nxt]); } dp[crr].push_back(1); } int main() { int n, k; cin >> n >> k; vector> grh(n); for (int i = 0; i < n - 1; i++) { int s, t; cin >> s >> t; grh[s].push_back(t); grh[t].push_back(s); } vector sz(n, 1); vector> dp(n); dfs(grh, sz, dp); cout << dp[0][k] << endl; return 0; }