#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; const int MOD = 1000000007; int solve(const vector >& edges, int curr, vector& ans) { int n = 1; ans.assign(n+1, 0); ans[0] = 1; for(int next : edges[curr]){ vector x; int m = solve(edges, next, x); vector y(n+m+1, 0); for(int i=0; i<=n; ++i){ for(int j=0; j<=m; ++j){ y[i+j] += ans[i] * x[j]; y[i+j] %= MOD; } } ans.swap(y); n += m; } ++ ans[n]; return n; } int main() { int n, k; cin >> n >> k; vector > edges(n); for(int i=0; i> a >> b; edges[a].push_back(b); } vector ans; solve(edges, 0, ans); cout << ans[k] << endl; return 0; }