#include #define GET_MACRO(a, b, c, NAME, ...) NAME #define rep(...) GET_MACRO(__VA_ARGS__, rep3, rep2)(__VA_ARGS__) #define rep2(i, a) rep3 (i, 0, a) #define rep3(i, a, b) for (int i = (a); i < (b); i++) #define repr(...) GET_MACRO(__VA_ARGS__, repr3, repr2)(__VA_ARGS__) #define repr2(i, a) repr3 (i, 0, a) #define repr3(i, a, b) for (int i = (b) - 1; i >= (a); i--) #define chmin(a, b) ((b) < a && (a = (b), true)) #define chmax(a, b) (a < (b) && (a = (b), true)) using namespace std; typedef long long ll; vector G[2020]; ll dp[2020][2020]; int size[2020]; const ll mod = 1e9 + 7; int dfs2(int curr, int prev) { size[curr] = 1; for (int next : G[curr]) if (next != prev) { size[curr] += dfs2(next, curr); } return size[curr]; } void dfs(int curr, int prev) { dp[curr][0] = 1; dp[curr][size[curr]] = 1; for (int next : G[curr]) if (next != prev) { dfs(next, curr); repr (i, size[curr]) if (dp[curr][i] > 0) rep (j, 1, size[next] + 1) { (dp[curr][i + j] += dp[curr][i] * dp[next][j]) %= mod; } } } int main() { int N, K; cin >> N >> K; rep (i, N - 1) { int u, v; cin >> u >> v; G[u].push_back(v); G[v].push_back(u); } dfs2(0, -1); dfs(0, -1); cout << dp[0][K] << endl; return 0; }