Problem: G: Tree

problem

Given a tree consisting of N vertices. Each vertex of the tree is numbered from 1 to N. Of the N-1 edges, the i \ (= 1, 2, ..., N-1) edge connects the vertex u_i and the vertex v_i.

Write a program to find the number of K non-empty subgraph sets of this tree, each of which is concatenated and no two different subgraphs share vertices. However, the answer can be very large, so answer the remainder divided by 998244353.

Note that if the set of K subgraphs is the same, the ones with different order of K subgraphs are also equated.

Input format


N K
u_1 v_1
::
u_ {N-1} v_ {N-1}


Constraint

* 2 \ leq N \ leq 10 ^ {5}
* 1 \ leq K \ leq min (N, 300)
* 1 \ leq u_i, v_i \ leq N
* u_i \ neq v_i
* For i \ neq j (u_i, v_i) \ neq (u_j, v_j)
* All inputs are given as integers.
* The graph given is guaranteed to be a tree.



Output format

Print the integer that represents the answer on one line. Note that it prints too much divided by 998244353.

Input example 1


3 2
1 2
13


Output example 1


Five

There are five ways:

* \\ {1 \\} and \\ {2 \\}
* \\ {1 \\} and \\ {3 \\}
* \\ {2 \\} and \\ {3 \\}
* \\ {1, 2 \\} and \\ {3 \\}
* \\ {1, 3 \\} and \\ {2 \\}



Input example 2


4 4
1 2
13
14


Output example 2


1

There is only one way (\\ {1 \\}, \\ {2 \\}, \\ {3 \\}, \\ {4 \\}).

Input example 3


7 4
1 7
twenty one
7 4
3 4
5 7
6 3


Output example 3


166





Example

Input

3 2
1 2
1 3


Output

5

Solution (in CPP):

Solution:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#pragma warning (disable: 4996)

const int mod = 998244353;

vector<int> X[100009];
int N, K, A[100009], B[100009];
long long dp[100009][309][2], dp2[100009][309], sz[100009];

void dfs(int pos) {
	sz[pos] = 1;

	vector<int>Y;
	for (int i = 0; i < X[pos].size(); i++) {
		if (sz[X[pos][i]] != 0) continue;
		Y.push_back(X[pos][i]);
		dfs(X[pos][i]);
		sz[pos] += sz[X[pos][i]];
	}

	vector<pair<int, int>> A;
	for (int i = 0; i < Y.size(); i++) A.push_back(make_pair(sz[Y[i]], Y[i]));
	sort(A.begin(), A.end());

	Y.clear();
	for (int i = 0; i < A.size(); i++) Y.push_back(A[i].second);

	// 含まない場合
	for (int i = 0; i <= Y.size(); i++) {
		for (int j = 0; j <= K; j++) dp2[i][j] = 0;
	}

	int S = 0; dp2[0][0] = 1;
	for (int i = 0; i < Y.size(); i++) {
		for (int j = 0; j <= S; j++) {
			for (int k = 0; k <= min(K, (int)sz[Y[i]]); k++) {
				if (j + k + 1 <= K) {
					dp2[i + 1][j + k + 1] += dp2[i][j] * dp[Y[i]][k][1];
					dp2[i + 1][j + k + 1] %= mod;
				}
				if (j + k <= K) {
					dp2[i + 1][j + k] += dp2[i][j] * dp[Y[i]][k][0];
					dp2[i + 1][j + k] %= mod;
				}
			}
		}
		S += sz[Y[i]]; S = min(S, K);
	}
	for (int i = 0; i <= K; i++) dp[pos][i][0] = dp2[Y.size()][i];

	// 含む場合
	for (int i = 0; i <= Y.size(); i++) {
		for (int j = 0; j <= K; j++) dp2[i][j] = 0;
	}

	S = 0; dp2[0][0] = 1;
	for (int i = 0; i < Y.size(); i++) {
		for (int j = 0; j <= S; j++) {
			for (int k = 0; k <= min(K, (int)sz[Y[i]]); k++) {
				if (j + k + 1 <= K) {
					dp2[i + 1][j + k + 1] += dp2[i][j] * dp[Y[i]][k][1];
					dp2[i + 1][j + k + 1] %= mod;
				}
				if (j + k <= K) {
					dp2[i + 1][j + k] += dp2[i][j] * dp[Y[i]][k][1];
					dp2[i + 1][j + k] %= mod;
				}
				if (j + k <= K) {
					dp2[i + 1][j + k] += dp2[i][j] * dp[Y[i]][k][0];
					dp2[i + 1][j + k] %= mod;
				}
			}
		}
		S += sz[Y[i]]; S = min(S, K);
	}
	for (int i = 0; i <= K; i++) dp[pos][i][1] = dp2[Y.size()][i];
}

int main() {
	scanf("%d%d", &N, &K);
	for (int i = 1; i <= N - 1; i++) {
		scanf("%d%d", &A[i], &B[i]);
		X[A[i]].push_back(B[i]);
		X[B[i]].push_back(A[i]);
	}
	dfs(1);
	cout << (dp[1][K][0] + dp[1][K - 1][1]) % mod << endl;
	return 0;
}