#include<bits/stdc++.h>
using namespace std;
#define M 500000
typedef long long ll;
typedef unsigned long long ull;
inline ll read() {
	char ch;
	ll f = 1, res = 0;
	while ((ch = getchar()) < '0' || ch > '9')
		if (ch == '-') f = -1;
	while (ch >= '0' && ch <= '9') {
		res = (res << 1) + (res << 3) + (ch ^ 48);
		ch = getchar();
	}
	return f * res;
}
inline void pt(ll u,ll mod) {
	printf("%lld", u);
	if (mod == 1)
		putchar(' ');
	else if (mod == 2)
		putchar('\n');
}
vector<ll>e[5010];
ll dp[5010][5010]={0};
const ll mod= 998244353;
inline ll e_pow(ll m,ll n,ll p) {
	ll ans = 1;
	while (n) {
		if (n & 1) {
			ans = ans * m % p;
		}
		m = m * m % p;
		n >>= 1;
	}
	return ans % p;
}
ll p,k;
void dfs(ll inx,ll fa) {
	for (auto v:e[inx]) {
		if (v == fa)
			continue;
		dfs(v, inx);
	}

	if (e[inx].size() == 1 && e[inx][0] == fa) {
		for (ll i = 0; i <= k; i++)
			dp[inx][i] = 1;
	}
	else if(e[inx].size()==1) {
		ll v = e[inx][0];
		dp[inx][0] = dp[v][k];
		for (ll i = 1; i <= k; i++)
			dp[inx][i] = (dp[v][k] + dp[v][i - 1]) % mod;
	}
	else {
		dp[inx][0] = 1;
		for (auto v:e[inx]) {
			if (v == fa)
				continue;
			dp[inx][0] = dp[inx][0] * dp[v][k] % mod;
		}
		for (ll i = 1; i <= k; i++) {
			ll sum = 1;
			ll t = min(i - 1, k - i - 1);//普遍最长
			for (auto v:e[inx]) {
				if (v == fa)
					continue;
				if (t < 0)
					sum = sum * dp[v][k] % mod;
				else
					sum = sum * (dp[v][k] + dp[v][t]) % mod;
			}
			ll temp = 0;
			for (auto v:e[inx]) {
				if (v == fa)
					continue;
				ll tt = i - 2;
				ll vv = dp[v][i - 1];
				if (tt >= 0)
					vv -= dp[v][tt];
				vv += mod;
				vv %= mod;
				if (vv == 0)
					continue;
				if (t < 0)
					temp += sum * e_pow(dp[v][k], mod - 2, mod) % mod * vv % mod;
				else if (t != i - 1)
					temp += sum * e_pow(dp[v][k] + dp[v][t], mod - 2, mod) % mod * vv % mod;
				temp %= mod;
			}
			if (t == i - 1)
				dp[inx][i] = sum;
			else
				dp[inx][i] = temp + dp[inx][i - 1];
			dp[inx][i] %= mod;
		}
	}
}
int main() {
	//freopen("../in", "r", stdin);
	//freopen("../out", "w", stdout);
	p = read(), k = read();
	ll pp = (p + 2) / 2;
	p--;
	while (p--) {
		ll a = read(), b = read();
		e[a].push_back(b);
		e[b].push_back(a);
	}
	dfs(pp, 0);
	pt(dp[pp][k], 2);
	return 0;
}