#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#include //using namespace std; using namespace std; #define MOD 1000000007 int n; int k; #define MAX 2001 vector g[MAX]; bool use[MAX]; vector v[MAX]; int countt[MAX]; inline void dfs(int b){ use[b] = true; for (int i = 0; i < v[b].size(); i++){ if (use[v[b][i]] == false){ dfs(v[b][i]); g[b].push_back(v[b][i]); } } } inline void dfs2(int b){ countt[b] = 1; for (int i = 0; i < g[b].size(); i++){ dfs2(g[b][i]); countt[b] += countt[g[b][i]]; } } long long int dp[MAX][MAX]; inline void dfs3(int b){ for (int i = 0; i < g[b].size(); i++){ dfs3(g[b][i]); } dp[b][0] = 1; dp[b][countt[b]] = 1; for (int i = 0; i < g[b].size(); i++){ int jyo = min(k, countt[g[b][i]]); int jj = min(jyo + 1, k); for (int j = k/*jj*/; j >= 0; j--){ //choose from g[b][i] for (int kk = 1; kk <=k/*<= jyo&&kk <= j*/; kk++){ dp[b][j] += dp[g[b][i]][kk] * dp[b][j - kk]; dp[b][j] %= MOD; } } } } int main(){ scanf("%d%d", &n, &k); for (int i = 1; i < n; i++){ int a, b; scanf("%d%d", &a, &b); v[a].push_back(b); v[b].push_back(a); } dfs(0); dfs2(0); dfs3(0); printf("%lld\n", dp[0][k]); return 0; }