#include using namespace std; #define repl(i, l, r) for (int i = (l); i < (int)(r); ++i) #define rep(i, n) repl(i, 0, n) #define CST(x) cout << fixed << setprecision(x) #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() using ll = long long; constexpr ll MOD = 1e9 + 7; 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}; const double PI = acos(-1); template using MaxHeap = priority_queue; template using MinHeap = priority_queue, greater>; template inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); } template inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); } template inline void yn(const T &a) { ((a) ? (cout << "Yes" << endl) : (cout << "No" << endl)); } template inline void YN(const T &a) { ((a) ? (cout << "YES" << endl) : (cout << "NO" << endl)); } int main() { cin.tie(nullptr); cout.tie(nullptr); 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].emplace_back(b), G[b].emplace_back(a); } vector> dp(n); auto f = [&G, &dp](auto self, const auto &v, const auto &p) -> int { int res = 1; dp[v].assign(res + 1, 0); dp[v][0] = 1; for (const auto &to : G[v]) { if (to == p) continue; res += self(self, to, v); } for (const auto &to : G[v]) { if (to == p) continue; vector merged(sz(dp[v]) + sz(dp[to]) - 1); rep(i, sz(dp[v])) rep(j, sz(dp[to])) { merged[i + j] += dp[v][i] * dp[to][j] % MOD; merged[i + j] %= MOD; } dp[v] = merged; } dp[v][res] = 1; return res; }; f(f, 0, -1); cout << dp[0][k] << endl; return 0; }