#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define LL long long const LL MOD = 1000000007; int nodesize[2001]; vector> child(2001); LL pt[2001] = { 1 }; LL pc[2001][2001]; LL par[2001]; int K; int dfs(int v){ for (int &u : child[v])nodesize[v]+=dfs(u); return (++nodesize[v]); } void dfs2(int v){ for (int i = K; i >= nodesize[v]; i--){ pt[i] = (MOD+pt[i] + pt[i - nodesize[v]] - pc[par[v]][i - nodesize[v]]) % MOD; pc[v][i] = (pc[par[v]][i] + pt[i - nodesize[v]] - pc[par[v]][i - nodesize[v]])%MOD; } for (int &u : child[v])dfs2(u); return; } int main(void){ int N; int a, b; cin >> N>>K; for (int i = 1; i < N; i++){ cin >> a >> b; child[a].push_back(b); par[b] = a; } dfs(0); dfs2(0); cout << pt[K] << endl; return(0); }