#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef pair pii; typedef long long ll; typedef ll int__; #define rep(i,j) for(int__ i=0;i<(int__)(j);i++) #define repeat(i,j,k) for(int__ i=(j);i<(int__)(k);i++) #define all(v) v.begin(),v.end() template ostream& operator << (ostream &os , const vector &v){ rep(i,v.size()) os << v[i] << (i!=v.size()-1 ? " " : "\n"); return os; } template istream& operator >> (istream &is , vector &v){ rep(i,v.size()) is >> v[i]; return is; } #ifdef DEBUG void debug(){ cerr << endl; } #endif template void debug(const F &car,const R&... cdr){ #ifdef DEBUG cerr << car << " "; debug(cdr...); #endif } using EdgeList = vector>; const ll MOD = 1000000007; EdgeList E; int K; vector convolution(const vector &A, const vector &B){ int size = A.size() - 1 + B.size() - 1; vector ret( min(K+1, size + 1) ); rep(i, A.size()){ rep(j, B.size()){ if(i + j > K) continue; ret[i+j] += (A[i] * B[j]) % MOD; ret[i+j] %= MOD; } } return ret; } vector dfs(int now, int pre){ vector ret = {1}; for(int nxt : E[now]){ if(nxt == pre) continue; ret = convolution(ret, dfs(nxt, now)); } if(ret.size() < K + 1) ret.push_back(1); debug("AT", now, ret); return ret; } bool solve(){ int N; cin >> N >> K; E.resize(N); rep(i,N-1){ int a, b; cin >> a >> b; E[a].push_back(b); E[b].push_back(a); } vector ans = dfs(0, -1); cout << ( ans.size() > K ? ans[K] : 0 )<< endl; return false; } int main() { ios::sync_with_stdio(false); while(solve()); return 0; }