#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")

#include<bits/stdc++.h>
using namespace std;

int n,k,dp[5002][5002],pref[2][5002],suff[5002][5002];
long long ans,mod=998244353;
vector<int> grafo[5002];
vector<pair<int,int> > v;

void dfs(int pos,int last){
	for(auto i : grafo[pos]){
		if(i!=last){
			dfs(i,pos);
		}
	}
	
	v.push_back({pos,last});
}

void f(int pos,int last){
	
	long long cont=0;
	vector<int> nod;
	
	for(auto i : grafo[pos]){
		if(i!=last){
			nod.push_back(i);
			for(int j=k+1;j>0;j--){
				dp[i][j]=dp[i][j-1];
			}
			
			dp[i][0]=0;
			for(int j=k+1;j>0;j--){
				dp[i][0]+=dp[i][j];
				dp[i][0]%=mod;
			}
			cont++;
		}
	}
	
	if(cont==0){
		dp[pos][0]=1;
		return;
	}
	
	for(int i=0;i<cont;i++){
		for(int j=1;j<=k;j++){
			dp[nod[i]][j]+=dp[nod[i]][j-1];
			dp[nod[i]][j]%=mod;
		}
	}
	
	for(int i=cont-1;i>=0;i--){
		for(int j=0;j<=k;j++){
			if(i==cont-1)suff[i][j]=dp[nod[i]][j];
			else {
				suff[i][j]=((long long)suff[i+1][j]*dp[nod[i]][j])%mod;
			}
		}
	}
	
	for(int i=0;i<cont;i++){
		for(int j=0;j<=k;j++){
			
			if(i==0)pref[i%2][j]=dp[nod[i]][j];
			else {
				pref[i%2][j]=((long long)pref[(i+1)%2][j]*dp[nod[i]][j])%mod;
			}
			
			if(j==0)continue;
			long long res=dp[nod[i]][j]-dp[nod[i]][j-1];
			if(i-1>=0){
				res*=pref[(i+1)%2][min(j-1,k-j)];
				res%=mod;
			}
			
			if(i+1<cont){
				res*=suff[i+1][min(j,k-j)];
				res%=mod;
			}
			
			dp[pos][j]+=res;
			dp[pos][j]%=mod;
		}
	}
	
	dp[pos][0]=pref[(cont+1)%2][0];
}

int main(){

	//ios::sync_with_stdio(false);
	//cin.tie(0);

	cin>>n>>k;
	
	for(int i=0;i<n-1;i++){
		int u,v;
		cin>>u>>v;
		grafo[u].push_back(v);
		grafo[v].push_back(u);
	}
	
	dfs(1,-1);
	
	for(int i=0;i<v.size();i++){
		f(v[i].first,v[i].second);
	}
	
	
	for(int i=0;i<=k;i++){
		ans+=dp[1][i];
		ans%=mod;
	}
	
	cout<<(ans%mod+mod)%mod<<"\n";

	return 0;
}

