#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cctype>
#include <vector>

using namespace std;

inline int read()
{
	int x=0,f=1;
	char ch=getchar();
	while (!isdigit(ch)) f=ch=='-'?-1:f,ch=getchar();
	while (isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*f;
}

const int P=998244353;

inline void add(int &x,int y){x=x+y>=P?x+y-P:x+y;}
inline void dec(int &x,int y){x=x<y?x-y+P:x-y;}
inline int quick_power(int x,int y)
{
	int ret=1;
	for (;y;y>>=1,x=1ll*x*x%P) if (y&1) ret=1ll*ret*x%P;
	return ret;
}

const int LGL=17;
const int L=1<<LGL;
const int G=3;

int poly[LGL][L];
int t[L],trs[L];
int omega[L+5];
int len;

void NTT_pre()
{
	int g=quick_power(G,(P-1)/L);omega[0]=1;
	for (int i=1;i<=L;++i) omega[i]=1ll*omega[i-1]*g%P;
}

inline void deg_pre(int deg)
{
	for (len=1;len<deg;len<<=1);
	for (int i=0,ret;i<len;++i)
	{
		ret=0;
		for (int x=i,j=1;j<len;j<<=1,x>>=1) ret=(ret<<1)|(x&1);
		trs[i]=ret;
	}
}

inline void DFT(int *a,int sig)
{
	for (register int i=0;i<len;++i) t[trs[i]]=a[i];
	for (register int l=2;l<=len;l<<=1)
		for (register int h=l>>1,j=0,wn=omega[sig>0?L/l:L-L/l];j<len;j+=l)
			for (register int i=0,w=1;i<h;++i,w=1ll*w*wn%P)
			{
				int u=t[i+j],v=1ll*t[i+j+h]*w%P;
				t[i+j]=(u+v)%P,t[i+j+h]=(u-v+P)%P;
			}
	for (register int i=0;i<len;++i) a[i]=t[i];
	if (sig<0) for (register int i=0,inv=quick_power(len,P-2);i<len;++i) a[i]=1ll*a[i]*inv%P;
}

inline void FFT(int *a,int *b,int *c)
{
	DFT(a,1),DFT(b,1);
	for (register int i=0;i<len;++i) c[i]=1ll*a[i]*b[i]%P;
	DFT(c,-1);
}

void solve(int *a,int l,int r,int d=0)
{
	if (l==r){poly[d][0]=1,poly[d][1]=a[l];return;}
	int mid=l+r>>1,deg=r-l+2,deg0=mid-l+2,deg1=r-mid+1;
	solve(a,l,mid,d+1),copy(poly[d+1],poly[d+1]+deg0,poly[d]),solve(a,mid+1,r,d+1);
	deg_pre(deg),fill(poly[d]+deg0,poly[d]+len,0),fill(poly[d+1]+deg1,poly[d+1]+len,0);
	FFT(poly[d],poly[d+1],poly[d]),fill(poly[d]+deg,poly[d]+len,0);
}

const int N=100005;
const int E=N<<1;
const int MAXK=100005;

int last[N],deg[N],size[N],ways[N];
int fact[MAXK],invf[MAXK];
int tov[E],nxt[E];
int n,K,tot,ans;

inline void insert(int x,int y){tov[++tot]=y,nxt[tot]=last[x],last[x]=tot;}

void pre()
{
	fact[0]=1;
	for (int i=1;i<=K;++i) fact[i]=1ll*fact[i-1]*i%P;
	invf[K]=quick_power(fact[K],P-2);
	for (int i=K;i>=1;--i) invf[i-1]=1ll*invf[i]*i%P;
}

inline int C(int n,int m){return n>=m?1ll*fact[n]*invf[m]%P*invf[n-m]%P:0;}

int kth[N],a[N];

inline bool cmp(int x,int y){return size[x]<size[y];}

inline void cancel(int *f,int x,int n){for (int i=1;i<=n;++i) dec(f[i],1ll*f[i-1]*x%P);}
inline void extend(int *f,int x,int n){for (int i=n;i>=1;--i) add(f[i],1ll*f[i-1]*x%P);}

void dfs(int x,int fa=0)
{
	ways[x]=0,size[x]=1;
	for (int i=last[x],y;i;i=nxt[i])
		if ((y=tov[i])!=fa)
			dfs(y,x),add(ans,1ll*ways[x]*ways[y]%P),add(ways[x],ways[y]),size[x]+=size[y];
	for (int i=last[x];i;i=nxt[i]) a[deg[x]++]=tov[i]==fa?n-size[x]:size[tov[i]];
	solve(a,0,deg[x]-1);int cnt=0;
	for (int i=last[x],y;i;i=nxt[i]) if ((y=tov[i])!=fa) kth[++cnt]=y;
	sort(kth+1,kth+1+cnt,cmp);
	for (int i=1,cur;i<=cnt;++i)
	{
		if (i==1||size[kth[i]]!=size[kth[i-1]])
		{
			if (i>1) extend(poly[0],size[kth[i-1]],deg[x]);
			cancel(poly[0],size[kth[i]],deg[x]),cur=0;
			for (int j=0,mul=ways[kth[i]];j<=deg[x];mul=1ll*mul*(++j)%P) add(cur,1ll*poly[0][j]*C(K,j)%P*mul%P);
		}
		add(ans,cur);
	}
	if (cnt) extend(poly[0],size[kth[cnt]],deg[x]);
	cancel(poly[0],n-size[x],deg[x]);
	for (int i=0,mul=1;i<=deg[x];mul=1ll*mul*(++i)%P) add(ways[x],1ll*poly[0][i]*C(K,i)%P*mul%P);
}

int main()
{
	//freopen("kpaths.in","r",stdin),freopen("kpaths.out","w",stdout);
	n=read(),K=read();
	if (n>1)
		if (K==1) ans=(1ll*n*(n-1)>>1)%P;
		else
		{
			for (int i=1,x,y;i<n;++i) x=read(),y=read(),insert(x,y),insert(y,x);
			pre(),NTT_pre(),ans=0,dfs(1);
		}
	printf("%d\n",ans);
	//fclose(stdin),fclose(stdout);
	return 0;
}


#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cctype>
#include <vector>

using namespace std;

inline int read()
{
	int x=0,f=1;
	char ch=getchar();
	while (!isdigit(ch)) f=ch=='-'?-1:f,ch=getchar();
	while (isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*f;
}

const int P=998244353;

inline void add(int &x,int y){x=x+y>=P?x+y-P:x+y;}
inline void dec(int &x,int y){x=x<y?x-y+P:x-y;}
inline int quick_power(int x,int y)
{
	int ret=1;
	for (;y;y>>=1,x=1ll*x*x%P) if (y&1) ret=1ll*ret*x%P;
	return ret;
}

const int LGL=17;
const int L=1<<LGL;
const int G=3;

int poly[LGL+2][L];
int t[L],trs[L];
int omega[L+5];
int len;

void NTT_pre()
{
	int g=quick_power(G,(P-1)/L);omega[0]=1;
	for (int i=1;i<=L;++i) omega[i]=1ll*omega[i-1]*g%P;
}

inline void deg_pre(int deg)
{
	for (len=1;len<deg;len<<=1);
	for (int i=0,ret;i<len;++i)
	{
		ret=0;
		for (int x=i,j=1;j<len;j<<=1,x>>=1) ret=(ret<<1)|(x&1);
		trs[i]=ret;
	}
}

inline void DFT(int *a,int sig)
{
	for (register int i=0;i<len;++i) t[trs[i]]=a[i];
	for (register int l=2;l<=len;l<<=1)
		for (register int h=l>>1,j=0,wn=omega[sig>0?L/l:L-L/l];j<len;j+=l)
			for (register int i=0,w=1;i<h;++i,w=1ll*w*wn%P)
			{
				int u=t[i+j],v=1ll*t[i+j+h]*w%P;
				t[i+j]=(u+v)%P,t[i+j+h]=(u-v+P)%P;
			}
	for (register int i=0;i<len;++i) a[i]=t[i];
	if (sig<0) for (register int i=0,inv=quick_power(len,P-2);i<len;++i) a[i]=1ll*a[i]*inv%P;
}

inline void FFT(int *a,int *b,int *c)
{
	DFT(a,1),DFT(b,1);
	for (register int i=0;i<len;++i) c[i]=1ll*a[i]*b[i]%P;
	DFT(c,-1);
}

void solve(int *a,int l,int r,int d=0)
{
	if (l==r){poly[d][0]=1,poly[d][1]=a[l];return;}
	int mid=l+r>>1,deg=r-l+2,deg0=mid-l+2,deg1=r-mid+1;
	solve(a,l,mid,d+1),copy(poly[d+1],poly[d+1]+deg0,poly[d]),solve(a,mid+1,r,d+1);
	deg_pre(deg),fill(poly[d]+deg0,poly[d]+len,0),fill(poly[d+1]+deg1,poly[d+1]+len,0);
	FFT(poly[d],poly[d+1],poly[d]),fill(poly[d]+deg,poly[d]+len,0);
}

const int N=100005;
const int E=N<<1;
const int MAXK=100005;

int last[N],deg[N],size[N],ways[N];
int fact[MAXK],invf[MAXK];
int tov[E],nxt[E];
int n,K,tot,ans;

inline void insert(int x,int y){tov[++tot]=y,nxt[tot]=last[x],last[x]=tot;}

void pre()
{
	fact[0]=1;
	for (int i=1;i<=K;++i) fact[i]=1ll*fact[i-1]*i%P;
	invf[K]=quick_power(fact[K],P-2);
	for (int i=K;i>=1;--i) invf[i-1]=1ll*invf[i]*i%P;
}

inline int C(int n,int m){return n>=m?1ll*fact[n]*invf[m]%P*invf[n-m]%P:0;}

int kth[N],a[N];

inline bool cmp(int x,int y){return size[x]<size[y];}

inline void cancel(int *f,int x,int n){for (int i=1;i<=n;++i) dec(f[i],1ll*f[i-1]*x%P);}
inline void extend(int *f,int x,int n){for (int i=n;i>=1;--i) add(f[i],1ll*f[i-1]*x%P);}

void dfs(int x,int fa=0)
{
	ways[x]=0,size[x]=1;
	for (int i=last[x],y;i;i=nxt[i])
		if ((y=tov[i])!=fa)
			dfs(y,x),add(ans,1ll*ways[x]*ways[y]%P),add(ways[x],ways[y]),size[x]+=size[y];
	for (int i=last[x];i;i=nxt[i]) a[deg[x]++]=tov[i]==fa?n-size[x]:size[tov[i]];
	solve(a,0,deg[x]-1);int cnt=0;
	for (int i=last[x],y;i;i=nxt[i]) if ((y=tov[i])!=fa) kth[++cnt]=y;
	sort(kth+1,kth+1+cnt,cmp);
	for (int i=1,cur;i<=cnt;++i)
	{
		if (i==1||size[kth[i]]!=size[kth[i-1]])
		{
			if (i>1) extend(poly[0],size[kth[i-1]],deg[x]);
			cancel(poly[0],size[kth[i]],deg[x]),cur=0;
			for (int j=0,mul=ways[kth[i]];j<=deg[x];mul=1ll*mul*(++j)%P) add(cur,1ll*poly[0][j]*C(K,j)%P*mul%P);
		}
		add(ans,cur);
	}
	if (cnt) extend(poly[0],size[kth[cnt]],deg[x]);
	cancel(poly[0],n-size[x],deg[x]);
	for (int i=0,mul=1;i<=deg[x];mul=1ll*mul*(++i)%P) add(ways[x],1ll*poly[0][i]*C(K,i)%P*mul%P);
}

int main()
{
	//freopen("kpaths.in","r",stdin),freopen("kpaths.out","w",stdout);
	n=read(),K=read();
	if (n>1)
		if (K==1) ans=(1ll*n*(n-1)>>1)%P;
		else
		{
			for (int i=1,x,y;i<n;++i) x=read(),y=read(),insert(x,y),insert(y,x);
			pre(),NTT_pre(),ans=0,dfs(1);
		}
	printf("%d\n",ans);
	//fclose(stdin),fclose(stdout);
	return 0;
}


#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cctype>
#include <vector>

using namespace std;

inline int read()
{
	int x=0,f=1;
	char ch=getchar();
	while (!isdigit(ch)) f=ch=='-'?-1:f,ch=getchar();
	while (isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*f;
}

const int P=998244353;

inline void add(int &x,int y){x=x+y>=P?x+y-P:x+y;}
inline void dec(int &x,int y){x=x<y?x-y+P:x-y;}
inline int quick_power(int x,int y)
{
	int ret=1;
	for (;y;y>>=1,x=1ll*x*x%P) if (y&1) ret=1ll*ret*x%P;
	return ret;
}

const int LGL=17;
const int L=1<<LGL;
const int G=3;

int poly[LGL][L];
int t[L],trs[L];
int omega[L+5];
int len;

void NTT_pre()
{
	int g=quick_power(G,(P-1)/L);omega[0]=1;
	for (int i=1;i<=L;++i) omega[i]=1ll*omega[i-1]*g%P;
}

inline void deg_pre(int deg)
{
	for (len=1;len<deg;len<<=1);
	for (int i=0,ret;i<len;++i)
	{
		ret=0;
		for (int x=i,j=1;j<len;j<<=1,x>>=1) ret=(ret<<1)|(x&1);
		trs[i]=ret;
	}
}

inline void DFT(int *a,int sig)
{
	for (register int i=0;i<len;++i) t[trs[i]]=a[i];
	for (register int l=2;l<=len;l<<=1)
		for (register int h=l>>1,j=0,wn=omega[sig>0?L/l:L-L/l];j<len;j+=l)
			for (register int i=0,w=1;i<h;++i,w=1ll*w*wn%P)
			{
				int u=t[i+j],v=1ll*t[i+j+h]*w%P;
				t[i+j]=(u+v)%P,t[i+j+h]=(u-v+P)%P;
			}
	for (register int i=0;i<len;++i) a[i]=t[i];
	if (sig<0) for (register int i=0,inv=quick_power(len,P-2);i<len;++i) a[i]=1ll*a[i]*inv%P;
}

inline void FFT(int *a,int *b,int *c)
{
	DFT(a,1),DFT(b,1);
	for (register int i=0;i<len;++i) c[i]=1ll*a[i]*b[i]%P;
	DFT(c,-1);
}

void solve(int *a,int l,int r,int d=0)
{
	if (l==r){poly[d][0]=1,poly[d][1]=a[l];return;}
	int mid=l+r>>1,deg=r-l+2,deg0=mid-l+2,deg1=r-mid+1;
	solve(a,l,mid,d+1),copy(poly[d+1],poly[d+1]+deg0,poly[d]),solve(a,mid+1,r,d+1);
	deg_pre(deg),fill(poly[d]+deg0,poly[d]+len,0),fill(poly[d+1]+deg1,poly[d+1]+len,0);
	FFT(poly[d],poly[d+1],poly[d]),fill(poly[d]+deg,poly[d]+len,0);
}

const int N=100005;
const int E=N<<1;
const int MAXK=100005;

int last[N],deg[N],size[N],ways[N];
int fact[MAXK],invf[MAXK];
int tov[E],nxt[E];
int n,K,tot,ans;

inline void insert(int x,int y){tov[++tot]=y,nxt[tot]=last[x],last[x]=tot;}

void pre()
{
	fact[0]=1;
	for (int i=1;i<=K;++i) fact[i]=1ll*fact[i-1]*i%P;
	invf[K]=quick_power(fact[K],P-2);
	for (int i=K;i>=1;--i) invf[i-1]=1ll*invf[i]*i%P;
}

inline int C(int n,int m){return n>=m?1ll*fact[n]*invf[m]%P*invf[n-m]%P:0;}

int kth[N],a[N];

inline bool cmp(int x,int y){return size[x]<size[y];}

inline void cancel(int *f,int x,int n){for (int i=1;i<=n;++i) dec(f[i],1ll*f[i-1]*x%P);}
inline void extend(int *f,int x,int n){for (int i=n;i>=1;--i) add(f[i],1ll*f[i-1]*x%P);}

void dfs(int x,int fa=0)
{
	ways[x]=0,size[x]=1;
	for (int i=last[x],y;i;i=nxt[i])
		if ((y=tov[i])!=fa)
			dfs(y,x),add(ans,1ll*ways[x]*ways[y]%P),add(ways[x],ways[y]),size[x]+=size[y];
	for (int i=last[x];i;i=nxt[i]) a[deg[x]++]=tov[i]==fa?n-size[x]:size[tov[i]];
	solve(a,0,deg[x]-1);int cnt=0;
	for (int i=last[x],y;i;i=nxt[i]) if ((y=tov[i])!=fa) kth[++cnt]=y;
	sort(kth+1,kth+1+cnt,cmp);
	for (int i=1,cur;i<=cnt;++i)
	{
		if (i==1||size[kth[i]]!=size[kth[i-1]])
		{
			if (i>1) extend(poly[0],size[kth[i-1]],deg[x]);
			cancel(poly[0],size[kth[i]],deg[x]),cur=0;
			for (int j=0,mul=ways[kth[i]];j<=deg[x];mul=1ll*mul*(++j)%P) add(cur,1ll*poly[0][j]*C(K,j)%P*mul%P);
		}
		add(ans,cur);
	}
	if (cnt) extend(poly[0],size[kth[cnt]],deg[x]);
	cancel(poly[0],n-size[x],deg[x]);
	for (int i=0,mul=1;i<=deg[x];mul=1ll*mul*(++i)%P) add(ways[x],1ll*poly[0][i]*C(K,i)%P*mul%P);
}

int main()
{
	//freopen("kpaths.in","r",stdin),freopen("kpaths.out","w",stdout);
	n=read(),K=read();
	if (K==1) ans=(1ll*n*(n-1)>>1)%P;
	else
	{
		for (int i=1,x,y;i<n;++i) x=read(),y=read(),insert(x,y),insert(y,x);
		pre(),NTT_pre(),ans=0,dfs(1);
	}
	printf("%d\n",ans);
	//fclose(stdin),fclose(stdout);
	return 0;
}


#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cctype>
#include <vector>

using namespace std;

inline int read()
{
	int x=0,f=1;
	char ch=getchar();
	while (!isdigit(ch)) f=ch=='-'?-1:f,ch=getchar();
	while (isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*f;
}

const int P=998244353;

inline void add(int &x,int y){x=x+y>=P?x+y-P:x+y;}
inline void dec(int &x,int y){x=x<y?x-y+P:x-y;}
inline int quick_power(int x,int y)
{
	int ret=1;
	for (;y;y>>=1,x=1ll*x*x%P) if (y&1) ret=1ll*ret*x%P;
	return ret;
}

const int LGL=18;
const int L=1<<LGL;
const int G=3;

int poly[LGL+1][L];
int t[L],trs[L];
int omega[L+5];
int len;

void NTT_pre()
{
	int g=quick_power(G,(P-1)/L);omega[0]=1;
	for (int i=1;i<=L;++i) omega[i]=1ll*omega[i-1]*g%P;
}

inline void deg_pre(int deg)
{
	for (len=1;len<deg;len<<=1);
	for (int i=0,ret;i<len;++i)
	{
		ret=0;
		for (int x=i,j=1;j<len;j<<=1,x>>=1) ret=(ret<<1)|(x&1);
		trs[i]=ret;
	}
}

inline void DFT(int *a,int sig)
{
	for (register int i=0;i<len;++i) t[trs[i]]=a[i];
	for (register int l=2;l<=len;l<<=1)
		for (register int h=l>>1,j=0,wn=omega[sig>0?L/l:L-L/l];j<len;j+=l)
			for (register int i=0,w=1;i<h;++i,w=1ll*w*wn%P)
			{
				int u=t[i+j],v=1ll*t[i+j+h]*w%P;
				t[i+j]=(u+v)%P,t[i+j+h]=(u-v+P)%P;
			}
	for (register int i=0;i<len;++i) a[i]=t[i];
	if (sig<0) for (register int i=0,inv=quick_power(len,P-2);i<len;++i) a[i]=1ll*a[i]*inv%P;
}

inline void FFT(int *a,int *b,int *c)
{
	DFT(a,1),DFT(b,1);
	for (register int i=0;i<len;++i) c[i]=1ll*a[i]*b[i]%P;
	DFT(c,-1);
}

void solve(int *a,int l,int r,int d=0)
{
	if (l==r){poly[d][0]=1,poly[d][1]=a[l];return;}
	int mid=l+r>>1,deg=r-l+2,deg0=mid-l+2,deg1=r-mid+1;
	solve(a,l,mid,d+1),copy(poly[d+1],poly[d+1]+deg0,poly[d]),solve(a,mid+1,r,d+1);
	deg_pre(deg),fill(poly[d]+deg0,poly[d]+len,0),fill(poly[d+1]+deg1,poly[d+1]+len,0);
	FFT(poly[d],poly[d+1],poly[d]),fill(poly[d]+deg,poly[d]+len,0);
}

const int N=100005;
const int E=N<<1;
const int MAXK=100005;

int last[N],deg[N],size[N],ways[N];
int fact[MAXK],invf[MAXK];
int tov[E],nxt[E];
int n,K,tot,ans;

inline void insert(int x,int y){tov[++tot]=y,nxt[tot]=last[x],last[x]=tot;}

void pre()
{
	fact[0]=1;
	for (int i=1;i<=K;++i) fact[i]=1ll*fact[i-1]*i%P;
	invf[K]=quick_power(fact[K],P-2);
	for (int i=K;i>=1;--i) invf[i-1]=1ll*invf[i]*i%P;
}

inline int C(int n,int m){return n>=m?1ll*fact[n]*invf[m]%P*invf[n-m]%P:0;}

int kth[N],a[N];

inline bool cmp(int x,int y){return size[x]<size[y];}

inline void cancel(int *f,int x,int n){for (int i=1;i<=n;++i) dec(f[i],1ll*f[i-1]*x%P);}
inline void extend(int *f,int x,int n){for (int i=n;i>=1;--i) add(f[i],1ll*f[i-1]*x%P);}

void dfs(int x,int fa=0)
{
	ways[x]=0,size[x]=1;
	for (int i=last[x],y;i;i=nxt[i])
		if ((y=tov[i])!=fa)
			dfs(y,x),add(ans,1ll*ways[x]*ways[y]%P),add(ways[x],ways[y]),size[x]+=size[y];
	for (int i=last[x];i;i=nxt[i]) a[deg[x]++]=tov[i]==fa?n-size[x]:size[tov[i]];
	solve(a,0,deg[x]-1);int cnt=0;
	for (int i=last[x],y;i;i=nxt[i]) if ((y=tov[i])!=fa) kth[++cnt]=y;
	sort(kth+1,kth+1+cnt,cmp);
	for (int i=1,cur;i<=cnt;++i)
	{
		if (i==1||size[kth[i]]!=size[kth[i-1]])
		{
			if (i>1) extend(poly[0],size[kth[i-1]],deg[x]);
			cancel(poly[0],size[kth[i]],deg[x]),cur=0;
			for (int j=0,mul=ways[kth[i]];j<=deg[x];mul=1ll*mul*(++j)%P) add(cur,1ll*poly[0][j]*C(K,j)%P*mul%P);
		}
		add(ans,cur);
	}
	if (cnt) extend(poly[0],size[kth[cnt]],deg[x]);
	cancel(poly[0],n-size[x],deg[x]);
	for (int i=0,mul=1;i<=deg[x];mul=1ll*mul*(++i)%P) add(ways[x],1ll*poly[0][i]*C(K,i)%P*mul%P);
}

int main()
{
	//freopen("kpaths.in","r",stdin),freopen("kpaths.out","w",stdout);
	n=read(),K=read();
	if (n>1)
		if (K==1) ans=(1ll*n*(n-1)>>1)%P;
		else
		{
			for (int i=1,x,y;i<n;++i) x=read(),y=read(),insert(x,y),insert(y,x);
			pre(),NTT_pre(),ans=0,dfs(1);
		}
	printf("%d\n",ans);
	//fclose(stdin),fclose(stdout);
	return 0;
}


#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cctype>
#include <vector>

using namespace std;

inline int read()
{
	int x=0,f=1;
	char ch=getchar();
	while (!isdigit(ch)) f=ch=='-'?-1:f,ch=getchar();
	while (isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	return x*f;
}

const int P=998244353;

inline void add(int &x,int y){x=x+y>=P?x+y-P:x+y;}
inline void dec(int &x,int y){x=x<y?x-y+P:x-y;}
inline int quick_power(int x,int y)
{
	int ret=1;
	for (;y;y>>=1,x=1ll*x*x%P) if (y&1) ret=1ll*ret*x%P;
	return ret;
}

const int LGL=17;
const int L=1<<LGL;
const int G=3;

int poly[LGL][L];
int t[L],trs[L];
int omega[L+5];
int len;

void NTT_pre()
{
	int g=quick_power(G,(P-1)/L);omega[0]=1;
	for (int i=1;i<=L;++i) omega[i]=1ll*omega[i-1]*g%P;
}

inline void deg_pre(int deg)
{
	for (len=1;len<deg;len<<=1);
	for (int i=0,ret;i<len;++i)
	{
		ret=0;
		for (int x=i,j=1;j<len;j<<=1,x>>=1) ret=(ret<<1)|(x&1);
		trs[i]=ret;
	}
}

inline void DFT(int *a,int sig)
{
	for (register int i=0;i<len;++i) t[trs[i]]=a[i];
	for (register int l=2;l<=len;l<<=1)
		for (register int h=l>>1,j=0,wn=omega[sig>0?L/l:L-L/l];j<len;j+=l)
			for (register int i=0,w=1;i<h;++i,w=1ll*w*wn%P)
			{
				int u=t[i+j],v=1ll*t[i+j+h]*w%P;
				t[i+j]=(u+v)%P,t[i+j+h]=(u-v+P)%P;
			}
	for (register int i=0;i<len;++i) a[i]=t[i];
	if (sig<0) for (register int i=0,inv=quick_power(len,P-2);i<len;++i) a[i]=1ll*a[i]*inv%P;
}

inline void FFT(int *a,int *b,int *c)
{
	DFT(a,1),DFT(b,1);
	for (register int i=0;i<len;++i) c[i]=1ll*a[i]*b[i]%P;
	DFT(c,-1);
}

void solve(int *a,int l,int r,int d=0)
{
	if (l==r){poly[d][0]=1,poly[d][1]=a[l];return;}
	int mid=l+r>>1,deg=r-l+2,deg0=mid-l+2,deg1=r-mid+1;
	solve(a,l,mid,d+1),copy(poly[d+1],poly[d+1]+deg0,poly[d]),solve(a,mid+1,r,d+1);
	deg_pre(deg),fill(poly[d]+deg0,poly[d]+len,0),fill(poly[d+1]+deg1,poly[d+1]+len,0);
	FFT(poly[d],poly[d+1],poly[d]),fill(poly[d]+deg,poly[d]+len,0);
}

const int N=100005;
const int E=N<<1;
const int MAXK=100005;

int last[N],deg[N],size[N],ways[N];
int fact[MAXK],invf[MAXK];
int tov[E],nxt[E];
int n,K,tot,ans;

inline void insert(int x,int y){tov[++tot]=y,nxt[tot]=last[x],last[x]=tot;}

void pre()
{
	fact[0]=1;
	for (int i=1;i<=K;++i) fact[i]=1ll*fact[i-1]*i%P;
	invf[K]=quick_power(fact[K],P-2);
	for (int i=K;i>=1;--i) invf[i-1]=1ll*invf[i]*i%P;
}

inline int C(int n,int m){return n>=m?1ll*fact[n]*invf[m]%P*invf[n-m]%P:0;}

int kth[N],a[N];

inline bool cmp(int x,int y){return size[x]<size[y];}

inline void cancel(int *f,int x,int n){for (int i=1;i<=n;++i) dec(f[i],1ll*f[i-1]*x%P);}
inline void extend(int *f,int x,int n){for (int i=n;i>=1;--i) add(f[i],1ll*f[i-1]*x%P);}

void dfs(int x,int fa=0)
{
	ways[x]=0,size[x]=1;
	for (int i=last[x],y;i;i=nxt[i])
		if ((y=tov[i])!=fa)
			dfs(y,x),add(ans,1ll*ways[x]*ways[y]%P),add(ways[x],ways[y]),size[x]+=size[y];
	for (int i=last[x];i;i=nxt[i]) a[deg[x]++]=tov[i]==fa?n-size[x]:size[tov[i]];
	solve(a,0,deg[x]-1);int cnt=0;
	for (int i=last[x],y;i;i=nxt[i]) if ((y=tov[i])!=fa) kth[++cnt]=y;
	sort(kth+1,kth+1+cnt,cmp);
	for (int i=1,cur;i<=cnt;++i)
	{
		if (i==1||size[kth[i]]!=size[kth[i-1]])
		{
			if (i>1) extend(poly[0],size[kth[i-1]],deg[x]);
			cancel(poly[0],size[kth[i]],deg[x]),cur=0;
			for (int j=0,mul=1;j<=deg[x];mul=1ll*mul*(++j)%P) add(cur,1ll*poly[0][j]*C(K,j)%P*mul%P);
		}
		add(ans,1ll*cur*ways[kth[i]]%P);
	}
	if (cnt) extend(poly[0],size[kth[cnt]],deg[x]);
	cancel(poly[0],n-size[x],deg[x]);
	for (int i=0,mul=1;i<=deg[x];mul=1ll*mul*(++i)%P) add(ways[x],1ll*poly[0][i]*C(K,i)%P*mul%P);
}

int main()
{
	//freopen("kpaths.in","r",stdin),freopen("kpaths.out","w",stdout);
	n=read(),K=read();
	if (n>1)
		if (K==1) ans=(1ll*n*(n-1)>>1)%P;
		else
		{
			for (int i=1,x,y;i<n;++i) x=read(),y=read(),insert(x,y),insert(y,x);
			pre(),NTT_pre(),ans=0,dfs(1);
		}
	printf("%d\n",ans);
	//fclose(stdin),fclose(stdout);
	return 0;
}


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

#define LL long long
#define LD long double
#define SC(t,x) static_cast<t>(x)
#define AR(t) vector < t >
#define PII pair < int, int >
#define PLL pair < LL, LL >
#define PIL pair < int, LL >
#define PLI pair < LL, int >
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define PRF first
#define PRS second
#define INIT(ar,val) memset ( ar, val, sizeof ( ar ) )
#define lp(loop,start,end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop,start,end) for ( int loop = start; loop > end; --loop )
#define lpi(loop,start,end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop,start,end) for ( int loop = start; loop >= end; --loop )
#define qmax(a,b) (((a)>(b))?(a):(b))
#define qmin(a,b) (((a)<(b))?(a):(b))
#define qabs(a) (((a)>=0)?(a):(-(a)))

const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 100007;
const int MAXS = 400007;
const int MAXL = 31;
const int MOD = 998244353;
const int RT = 3;

struct eT
{
	void setd ( int _u, int _v, int _l )
	{
		u = _u, v = _v, last = _l;
	}

	int u, v, last;
}edge[MAXN*2];

int n, K;
int ans;
int ke, la[MAXN];
int sz[MAXN];
int dp[MAXN], cv[MAXN];
int na[MAXN], tmp[MAXN*2], cd[MAXN];
int frac[MAXN], rf[MAXN];
int ca[MAXS], cb[MAXS], cans[MAXS], rt[MAXS];
map < int, int > mp;

void init ();
void input ();
void work ();

int dfs ( int now, int fa );

int getval ( int a[], int n, int x );
void polydiv ( int a[], int n, int x, int ans[] );

void fft ( int ar[], int tn );
void mul ( int a[], int n, int b[], int m, int ans[] );
void muldivi ( int a[], int l, int r, int ans[] );

int add ( int x, int y )
{
	x += y;
	if ( x >= MOD ) x -= MOD;
	return x;
}

void addv ( int &x, int y )
{
	x += y;
	if ( x >= MOD ) x -= MOD;
}

int dec ( int x, int y )
{
	x -= y;
	if ( x < 0 ) x += MOD;
	return x;
}

void decv ( int &x, int y )
{
	x -= y;
	if ( x < 0 ) x += MOD;
}

int qpow ( int a, int b )
{
	LL base = a, ans = 1;
	while ( b ){
		if ( b & 1 ) ( ans *= base ) %= MOD;
		( base *= base ) %= MOD;
		b >>= 1;
	}
	return SC ( int, ans );
}

int main()
{
	init();
	input();
	work();
}

void init ()
{
	// Init Everything Here

	ios::sync_with_stdio ( false );

	frac[0] = 1;
	lp ( i, 1, MAXN ) frac[i] = frac[i-1] * SC ( LL, i ) % MOD;
	rf[MAXN-1] = qpow ( frac[MAXN-1], MOD-2 );
	lpdi ( i, MAXN-2, 0 ) rf[i] = rf[i+1] * SC ( LL, i + 1 ) % MOD;
}

void input ()
{
	// input method

	scanf ( "%d%d", &n, &K );
	int u, v;
	INIT ( la, -1 );
	lp ( i, 1, n ){
		scanf ( "%d%d", &u, &v );
		edge[ke].setd ( u, v, la[u] );
		la[u] = ke++;
		edge[ke].setd ( v, u, la[v] );
		la[v] = ke++;
	}
}

void work ()
{
	// main work

	if ( K == 1 ){
		printf ( "%d\n", ( SC ( LL, n ) * ( n - 1 ) >> 1 ) % MOD );
		return;
	}

	dfs ( 1, -1 );

	cout << ans << endl;
}

int dfs ( int now, int fa )
{
	sz[now] = 1;
	for ( int i = la[now]; ~i; i = edge[i].last ) if ( edge[i].v ^ fa ) sz[now] += dfs ( edge[i].v, now );

//	cerr << "dfs : " << now << endl;

	int pv = 0;
	for ( int i = la[now]; ~i; i = edge[i].last ){
		if ( edge[i].v ^ fa ){
//			cerr << "2 : " << edge[i].v << " : " << dp[edge[i].v] << " " << pv << endl;
			addv ( ans, SC ( LL, pv ) * dp[edge[i].v] % MOD );
			addv ( pv, dp[edge[i].v] );
		}
	}
	dp[now] = pv;

	int nd = 0;
	for ( int i = la[now]; ~i; i = edge[i].last ) if ( edge[i].v ^ fa ) na[++nd] = sz[edge[i].v];
	na[++nd] = n - sz[now];

	muldivi ( na, 1, nd, tmp );
	lpi ( i, 0, nd ) na[i] = tmp[i];

	mp.clear ();
	for ( int i = la[now]; ~i; i = edge[i].last ){
		if ( edge[i].v ^ fa ){
//			cerr << "1 : " << edge[i].v << " : " << dp[edge[i].v] << " " << getval ( na, nd, sz[edge[i].v] ) << endl;
			addv ( ans, SC ( LL, dp[edge[i].v] ) * getval ( na, nd, sz[edge[i].v] ) % MOD );
		}
	}

	addv ( dp[now], getval ( na, nd, n-sz[now] ) );

	return sz[now];
}

int getval ( int a[], int n, int x )
{
	map < int, int > ::iterator it;
	if ( ( it = mp.find ( x ) ) != mp.end () ) return it->second;
	else{
		polydiv ( a, n, x, cd );
		int ub = qmin ( n - 1, K ), ans = 0;
		lpi ( i, 0, ub ) addv ( ans, SC ( LL, cd[i] ) * rf[K-i] % MOD );
		ans = SC ( LL, ans ) * frac[K] % MOD;
		mp[x] = ans;
		return ans;
	}
}

void polydiv ( int a[], int n, int x, int ans[] )
{
	lpi ( i, 0, n ) ans[i] = a[i];
	lp ( i, 0, n ) decv ( ans[i+1], SC ( LL, ans[i] ) * x % MOD );
}

void fft ( int ar[], int tn )
{
	for ( int i = 0, j = 0; i < tn; ++i ){
		if ( i > j ) swap ( ar[i], ar[j] );
		for ( int bt = tn >> 1; bt && ( ! ( ( j ^= bt ) & bt ) ); bt >>= 1 );
	}

	int m, x, y;
	for ( int i = 2; i <= tn; i <<= 1 ){
		m = i >> 1;
		for ( int j = 0; j < tn; j += i ){
			lp ( k, 0, m ){
				x = ar[j+k], y = SC ( LL, ar[j+k+m] ) * rt[tn/i*k] % MOD;
				ar[j+k] = add ( x, y );
				ar[j+k+m] = dec ( x, y );
			}
		}
	}
}

void mul ( int a[], int n, int b[], int m, int ans[] )
{
	int nm = n + m;
	int tn = 1;
	while ( tn <= nm ) tn <<= 1;
	lpi ( i, 0, n ) ca[i] = a[i];
	lp ( i, n+1, tn ) ca[i] = 0;
	lpi ( i, 0, m ) cb[i] = b[i];
	lp ( i, m+1, tn ) cb[i] = 0;
	int nrt = qpow ( RT, ( MOD - 1 ) / tn );
	rt[0] = 1;
	lp ( i, 1, tn ) rt[i] = SC ( LL, rt[i-1] ) * nrt % MOD;
	fft ( ca, tn );
	fft ( cb, tn );
	lp ( i, 0, tn ) cans[i] = SC ( LL, ca[i] ) * cb[i] % MOD;
	reverse ( rt+1, rt+tn );
	fft ( cans, tn );
	int rn = qpow ( tn, MOD-2 );
	lpi ( i, 0, nm ) ans[i] = SC ( LL, cans[i] ) * rn % MOD;
}

void muldivi ( int a[], int l, int r, int ans[] )
{
	if ( l == r ){
		ans[0] = 1;
		ans[1] = a[l];
		return;
	}

	int mid = ( l + r ) >> 1;
	muldivi ( a, l, mid, ans );
	muldivi ( a, mid+1, r, ans+((mid-l+1)<<1) );
	mul ( ans, mid-l+1, ans+((mid-l+1)<<1), r-mid, ans );
}


#include <bits/stdc++.h>

const int MAXN = 262145;
const int mod = 998244353;
typedef long long LL;
void reduce(int & x) { x += x >> 31 & mod; }
int mul(int a, int b) { return (LL) a * b % mod; }
int pow(int a, int b, int res = 1) {
	for (; b; b >>= 1, a = mul(a, a)) if (b & 1) res = mul(res, a);
	return res;
}
int remod(LL x) { x %= mod; return x + (x >> 63 & mod); }
int wn[MAXN], wt[MAXN];
int rev[MAXN], lim, dig;
void init(int sz) {
	lim = 1, dig = -1;
	while (lim < sz) lim <<= 1, ++dig;
	for (int i = 0; i < lim; ++i) rev[i] = rev[i >> 1] >> 1 | (i & 1) << dig;
	const int Wn = pow(3, (mod - 1) / lim);
	*wn = 1;
	for (int i = 1; i <= lim; ++i) wn[i] = mul(wn[i - 1], Wn);
}
void NTT(int * A, int typ) {
	for (int i = 0; i < lim; ++i) if (i < rev[i]) std::swap(A[i], A[rev[i]]);
	for (int mid = 1; mid != lim; mid <<= 1) {
		const int Wn = lim / mid / 2;
		for (int i = 0, W = 0; i != mid; ++i, W += Wn)
			wt[i] = wn[typ == 1 ? W : lim - W];
		for (int k = 0; k != lim; k += mid << 1) {
			const int * W = wt;
			for (int l = 0; l != mid; ++l) {
				const int X = A[l + k], Y = mul(*W++, A[l + k + mid]);
				reduce(A[l + k] += Y - mod);
				reduce(A[l + k + mid] = X - Y);
			}
		}
	}
	if (typ == -1) {
		const int liminv = pow(lim, mod - 2);
		for (int i = 0; i != lim; ++i) A[i] = mul(A[i], liminv);
	}
}
int head[MAXN], nxt[MAXN], to[MAXN], tot;
void adde(int b, int e) {
	nxt[++tot] = head[b]; to[head[b] = tot] = e;
	nxt[++tot] = head[e]; to[head[e] = tot] = b;
}
int n, K;
int fac[MAXN], inv[MAXN];
int dp[MAXN], sz[MAXN];
typedef std::vector<int> V;
int li[MAXN], lp[MAXN], bak;
V operator * (const V & a, const V & b) {
	static int ta[MAXN], tb[MAXN];
	const int ls = a.size(), rs = b.size();
	const int sz = ls + rs - 1; init(sz);
	std::copy(a.begin(), a.end(), ta);
	std::copy(b.begin(), b.end(), tb);
	std::fill(ta + ls, ta + lim, 0);
	std::fill(tb + rs, tb + lim, 0);
	NTT(ta, 1); NTT(tb, 1);
	for (int i = 0; i < lim; ++i) ta[i] = mul(ta[i], tb[i]);
	NTT(ta, -1);
	return V(ta, ta + sz);
}
V operator + (const V & a, const V & b) {
	static int res[MAXN];
	const int ls = a.size(), rs = b.size();
	const int sz = std::max(ls, rs);
	std::fill(res, res + sz, 0);
	for (int i = 0; i != ls; ++i) res[i] = a[i];
	for (int i = 0; i != rs; ++i) reduce(res[i] += b[i] - mod);
	return V(res, res + sz);
}
typedef std::pair<V, V> pi;
pi divcon(int l, int r) {
	if (l > r) return pi({1}, {0});
	if (l == r) return pi({1, li[l]}, {lp[l]});
	const int mid = l + r >> 1;
	pi L = divcon(l, mid), R = divcon(mid + 1, r);
	return pi(L.first * R.first, L.first * R.second + L.second * R.first);
}
std::pair<int, int> solve(int up) {
	pi rx = divcon(1, bak);
	const V & r1 = rx.first;
	V r2 = rx.second * V({1, up});
	int ans = 0, ans2 = 0;
	const int sz = r1.size();
	for (int i = 0; i < sz && i <= K; ++i) {
		reduce(ans += mul(r1[i], inv[K - i]) - mod);
		reduce(ans2 += mul(r2[i], inv[K - i]) - mod);
	}
	ans = mul(ans, fac[K]);
	ans2 = mul(ans2, fac[K]);
	return std::make_pair(ans, ans2);
}
int Ans = 0;
void dfs(int u, int fa = 0) {
	sz[u] = 1;
	for (int i = head[u]; i; i = nxt[i]) if (to[i] != fa) {
		dfs(to[i], u);
		sz[u] += sz[to[i]];
		reduce(Ans += mul(dp[u], dp[to[i]]) - mod);
		reduce(dp[u] += dp[to[i]] - mod);
	}
	for (int i = head[u]; i; i = nxt[i]) if (to[i] != fa)
		li[++bak] = sz[to[i]], lp[bak] = dp[to[i]];
	auto res = solve(n - sz[u]);
	reduce(dp[u] += res.first - mod);
	reduce(Ans += res.second - mod);
	bak = 0;
}
int main() {
	fac[0] = fac[1] = inv[0] = inv[1] = 1;
	for (int i = 2; i != MAXN; ++i) {
		fac[i] = mul(fac[i - 1], i);
		inv[i] = mul(inv[mod % i], mod - mod / i);
	}
	for (int i = 2; i != MAXN; ++i)
		inv[i] = mul(inv[i - 1], inv[i]);
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	std::cin >> n >> K;
	if (K == 1)
		return std::cout << ((LL) n * (n - 1) / 2) % mod << std::endl, 0;
	for (int i = 1, t1, t2; i < n; ++i)
		std::cin >> t1 >> t2, adde(t1, t2);
	dfs(1);
	std::cout << Ans << std::endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int long long
const int N=1<<21|1,M=998244353;
int rev[N],w[N],a[N],fac[N],inv[N],n,m,b[N],val[N],val3[N],num[N],Ans,size[N],zz[N],ne[N],tot,x,y,fi[N],c[N];
inline void reduce(int&x){x%=M;x+=M;x%=M;}
inline int ksm(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(ll)x*x%M)
		if (y&1)ans=(ll)ans*x%M;
	return ans;
}
inline void init(int len){
	for (int i=1;i<len;i++)rev[i]=rev[i>>1]>>1|((i&1)*len/2);
}
inline void INIT(int len){
	for (int mid=1;mid<len;mid<<=1){
		const int wn=ksm(3,M/mid/2);w[mid]=1;
		for (int i=1;i<mid;++i)w[i+mid]=(ll)w[i+mid-1]*wn%M;
	}
}
inline void ntt(int y[],int len,int opt){
	for (int i=1;i<len;i++)
		if (rev[i]>i)swap(y[i],y[rev[i]]);
	for (int h=1;h<len;h<<=1)
		for (int j=0;j<len;j+=h+h)
			for(int k=0;k<h;++k){
				const int x=(ll)y[h+j+k]*w[h+k]%M;
				reduce(y[h+j+k]=y[j+k]-x);
				reduce(y[j+k]+=x-M);
			}
	if (opt==-1){
		int temp=ksm(len,M-2);
		for (int i=0;i<len;i++)y[i]=(ll)y[i]*temp%M;
		reverse(y+1,y+len);
	}
}
inline void solve(int l,int r,int Ans[]){
	if (l==r){
		Ans[0]=1;
		Ans[1]=size[a[l]];
		return;
	}
	int len=1,mid=(l+r)/2;
	while (len<=r-l+2)len<<=1;
	int Ans1[len],Ans2[len];
	memset(Ans1,0,len<<2);memset(Ans2,0,len<<2);memset(Ans,0,len<<2);
	solve(l,mid,Ans1);solve(mid+1,r,Ans2);
	init(len);
	ntt(Ans1,len,1);
	ntt(Ans2,len,1);
	for (int i=0;i<len;i++)Ans[i]=(ll)Ans1[i]*Ans2[i]%M;
	ntt(Ans,len,-1);
}
void jb(int x,int y){
	ne[++tot]=fi[x];
	fi[x]=tot;
	zz[tot]=y;
}
int cmp(int x,int y){
	return size[x]<size[y];
}
void dfs(int x,int y){
	size[x]=1;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y){
			dfs(zz[i],x);
			size[x]+=size[zz[i]];
		}
	int cnt=0;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y)a[cnt++]=zz[i];
	if (!cnt){
		num[x]=1;
		return;
	}
	int len=1;
	while (len<=cnt+2)len<<=1;
	INIT(len);
	solve(0,cnt-1,val);
	for (int j=cnt;j>=0;j--)reduce(val3[j+1]+=(ll)val[j]*(n-size[x])%M-M),reduce(val3[j]+=val[j]-M);
	for (int i=0,j=0;i<cnt;i+=j){
		while (j<cnt&&size[a[i]]==size[a[j]])j++;
		for (int j=cnt+1;j>=0;j--)b[j]=val3[j];
		int V=ksm(size[a[i]],M-2),val2=0;
		for (int j=cnt;j>=0;j--)c[j]=(ll)b[j+1]*V%M,reduce(b[j]-=c[j]);
		for (int j=0;j<=cnt&&j<=m;j++)reduce(val2+=(ll)c[j]*inv[m-j]%M-M);
		val2=(ll)val2*fac[m]%M;
		for (int k=i;k<j;k++)reduce(Ans+=(ll)num[a[k]]*val2%M-M);
	}
	memset(val3,0,(cnt+2)<<2);
	for (int i=0;i<cnt;i++)reduce(Ans+=(ll)num[a[i]]*num[x]%M-M),reduce(num[x]+=num[a[i]]-M);
	int ppp=0;
	for (int i=0;i<=cnt&&i<=m;i++)reduce(ppp+=(ll)inv[m-i]*val[i]%M-M);
	reduce(num[x]+=(ll)ppp*fac[m]%M-M);
}
signed main(){
	scanf("%lld%lld",&n,&m);
	if (m==1){
		printf("%lld\n",(ll)n*(n-1)/2%M);
		return 0;
	}
	for (int i=1;i<n;i++){
		scanf("%lld%lld",&x,&y);
		jb(x,y);jb(y,x);
	}
	fac[0]=inv[0]=1;
	for (int i=1;i<=m;i++)fac[i]=(ll)fac[i-1]*i%M,inv[i]=ksm(fac[i],M-2);
	dfs(1,0);
	printf("%lld\n",Ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1<<21|1,M=998244353;
int rev[N],w[N],a[N],fac[N],inv[N],n,m,b[N],val[N],val3[N],num[N],Ans,size[N],zz[N],ne[N],tot,x,y,fi[N],c[N];
inline void reduce(int&x){x+=x>>31&M;}
inline int ksm(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(ll)x*x%M)
		if (y&1)ans=(ll)ans*x%M;
	return ans;
}
inline void init(int len){
	for (int i=1;i<len;i++)rev[i]=rev[i>>1]>>1|((i&1)*len/2);
}
inline void INIT(int len){
	for (int mid=1;mid<len;mid<<=1){
		const int wn=ksm(3,M/mid/2);w[mid]=1;
		for (int i=1;i<mid;++i)w[i+mid]=(ll)w[i+mid-1]*wn%M;
	}
}
inline void ntt(int y[],int len,int opt){
	for (int i=1;i<len;i++)
		if (rev[i]>i)swap(y[i],y[rev[i]]);
	for (int h=1;h<len;h<<=1)
		for (int j=0;j<len;j+=h+h)
			for(int k=0;k<h;++k){
				const int x=(ll)y[h+j+k]*w[h+k]%M;
				reduce(y[h+j+k]=y[j+k]-x);
				reduce(y[j+k]+=x-M);
			}
	if (opt==-1){
		int temp=ksm(len,M-2);
		for (int i=0;i<len;i++)y[i]=(ll)y[i]*temp%M;
		reverse(y+1,y+len);
	}
}
inline void solve(int l,int r,int Ans[]){
	if (l==r){
		Ans[0]=1;
		Ans[1]=size[a[l]];
		return;
	}
	int len=1,mid=(l+r)/2;
	while (len<=r-l+2)len<<=1;
	int Ans1[len],Ans2[len];
	memset(Ans1,0,len<<2);memset(Ans2,0,len<<2);memset(Ans,0,len<<2);
	solve(l,mid,Ans1);solve(mid+1,r,Ans2);
	init(len);
	ntt(Ans1,len,1);
	ntt(Ans2,len,1);
	for (int i=0;i<len;i++)Ans[i]=(ll)Ans1[i]*Ans2[i]%M;
	ntt(Ans,len,-1);
}
void jb(int x,int y){
	ne[++tot]=fi[x];
	fi[x]=tot;
	zz[tot]=y;
}
int cmp(int x,int y){
	return size[x]<size[y];
}
void dfs(int x,int y){
	size[x]=1;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y){
			dfs(zz[i],x);
			size[x]+=size[zz[i]];
		}
	int cnt=0;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y)a[cnt++]=zz[i];
	sort(a,a+cnt,cmp);
	if (!cnt){
		num[x]=1;
		return;
	}
	int len=1;
	while (len<=cnt+2)len<<=1;
	INIT(len);
	solve(0,cnt-1,val);
	for (int j=cnt;j>=0;j--)reduce(val3[j+1]+=(ll)val[j]*(n-size[x])%M-M),reduce(val3[j]+=val[j]-M);
	for (int i=0;i<cnt;i++){
		while (j<cnt&&size[a[i]]==size[a[j]])j++;
		for (int j=cnt+1;j>=0;j--)b[j]=val3[j];
		int V=ksm(size[a[i]],M-2),val2=0;
		for (int j=cnt;j>=0;j--)c[j]=(ll)b[j+1]*V%M,reduce(b[j]-=c[j]);
		for (int j=0;j<=cnt&&j<=m;j++)reduce(val2+=(ll)c[j]*inv[m-j]%M-M);
		val2=(ll)val2*fac[m]%M;
		reduce(Ans+=(ll)num[a[i]]*val2%M-M);
	}
	memset(val3,0,(cnt+2)<<2);
	for (int i=0;i<cnt;i++)reduce(Ans+=(ll)num[a[i]]*num[x]%M-M),reduce(num[x]+=num[a[i]]-M);
	int ppp=0;
	for (int i=0;i<=cnt&&i<=m;i++)reduce(ppp+=(ll)inv[m-i]*val[i]%M-M);
	reduce(num[x]+=(ll)ppp*fac[m]%M-M);
}
signed main(){
	scanf("%d%d",&n,&m);
	if (m==1){
		printf("%lld\n",(ll)n*(n-1)/2%M);
		return 0;
	}
	for (int i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		jb(x,y);jb(y,x);
	}
	fac[0]=inv[0]=1;
	for (int i=1;i<=m;i++)fac[i]=(ll)fac[i-1]*i%M,inv[i]=ksm(fac[i],M-2);
	dfs(1,0);
	printf("%d\n",Ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1<<21|1,M=998244353;
int rev[N],w[N],a[N],fac[N],inv[N],n,m,b[N],val[N],val3[N],num[N],Ans,size[N],zz[N],ne[N],tot,x,y,fi[N],c[N];
inline void reduce(int&x){x+=x>>31&M;}
inline int ksm(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(ll)x*x%M)
		if (y&1)ans=(ll)ans*x%M;
	return ans;
}
inline void init(int len){
	for (int i=1;i<len;i++)rev[i]=rev[i>>1]>>1|((i&1)*len/2);
}
inline void INIT(int len){
	for (int mid=1;mid<len;mid<<=1){
		const int wn=ksm(3,M/mid/2);w[mid]=1;
		for (int i=1;i<mid;++i)w[i+mid]=(ll)w[i+mid-1]*wn%M;
	}
}
inline void ntt(int y[],int len,int opt){
	for (int i=1;i<len;i++)
		if (rev[i]>i)swap(y[i],y[rev[i]]);
	for (int h=1;h<len;h<<=1)
		for (int j=0;j<len;j+=h+h)
			for(int k=0;k<h;++k){
				const int x=(ll)y[h+j+k]*w[h+k]%M;
				reduce(y[h+j+k]=y[j+k]-x);
				reduce(y[j+k]+=x-M);
			}
	if (opt==-1){
		int temp=ksm(len,M-2);
		for (int i=0;i<len;i++)y[i]=(ll)y[i]*temp%M;
		reverse(y+1,y+len);
	}
}
inline void solve(int l,int r,int Ans[]){
	if (l==r){
		Ans[0]=1;
		Ans[1]=size[a[l]];
		return;
	}
	int len=1,mid=(l+r)/2;
	while (len<=r-l+2)len<<=1;
	int Ans1[len],Ans2[len];
	memset(Ans1,0,len<<2);memset(Ans2,0,len<<2);memset(Ans,0,len<<2);
	solve(l,mid,Ans1);solve(mid+1,r,Ans2);
	init(len);
	ntt(Ans1,len,1);
	ntt(Ans2,len,1);
	for (int i=0;i<len;i++)Ans[i]=(ll)Ans1[i]*Ans2[i]%M;
	ntt(Ans,len,-1);
}
void jb(int x,int y){
	ne[++tot]=fi[x];
	fi[x]=tot;
	zz[tot]=y;
}
int cmp(int x,int y){
	return size[x]<size[y];
}
void dfs(int x,int y){
	size[x]=1;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y){
			dfs(zz[i],x);
			size[x]+=size[zz[i]];
		}
	int cnt=0;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y)a[cnt++]=zz[i];
	sort(a,a+cnt,cmp);
	if (!cnt){
		num[x]=1;
		return;
	}
	int len=1;
	while (len<=cnt+2)len<<=1;
	INIT(len);
	solve(0,cnt-1,val);
	for (int j=cnt;j>=0;j--)reduce(val3[j+1]+=(ll)val[j]*(n-size[x])%M-M),reduce(val3[j]+=val[j]-M);
	for (int i=0;i<cnt;i++){
		for (int j=cnt+1;j>=0;j--)b[j]=val3[j];
		int V=ksm(size[a[i]],M-2),val2=0;
		for (int j=cnt;j>=0;j--)c[j]=(ll)b[j+1]*V%M,reduce(b[j]-=c[j]);
		for (int j=0;j<=cnt&&j<=m;j++)reduce(val2+=(ll)c[j]*inv[m-j]%M-M);
		val2=(ll)val2*fac[m]%M;
		reduce(Ans+=(ll)num[a[i]]*val2%M-M);
	}
	memset(val3,0,(cnt+2)<<2);
	for (int i=0;i<cnt;i++)reduce(Ans+=(ll)num[a[i]]*num[x]%M-M),reduce(num[x]+=num[a[i]]-M);
	int ppp=0;
	for (int i=0;i<=cnt&&i<=m;i++)reduce(ppp+=(ll)inv[m-i]*val[i]%M-M);
	reduce(num[x]+=(ll)ppp*fac[m]%M-M);
}
signed main(){
	scanf("%d%d",&n,&m);
	if (m==1){
		printf("%lld\n",(ll)n*(n-1)/2%M);
		return 0;
	}
	for (int i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		jb(x,y);jb(y,x);
	}
	fac[0]=inv[0]=1;
	for (int i=1;i<=m;i++)fac[i]=(ll)fac[i-1]*i%M,inv[i]=ksm(fac[i],M-2);
	dfs(1,0);
	printf("%d\n",Ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1<<21|1,M=998244353;
int rev[N],w[N],a[N],fac[N],inv[N],n,m,b[N],val[N],val3[N],num[N],Ans,size[N],zz[N],ne[N],tot,x,y,fi[N],c[N];
inline void reduce(int&x){x%=M;x+=M;x%=M;}
inline int ksm(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(ll)x*x%M)
		if (y&1)ans=(ll)ans*x%M;
	return ans;
}
inline void init(int len){
	for (int i=1;i<len;i++)rev[i]=rev[i>>1]>>1|((i&1)*len/2);
}
inline void INIT(int len){
	for (int mid=1;mid<len;mid<<=1){
		const int wn=ksm(3,M/mid/2);w[mid]=1;
		for (int i=1;i<mid;++i)w[i+mid]=(ll)w[i+mid-1]*wn%M;
	}
}
inline void ntt(int y[],int len,int opt){
	for (int i=1;i<len;i++)
		if (rev[i]>i)swap(y[i],y[rev[i]]);
	for (int h=1;h<len;h<<=1)
		for (int j=0;j<len;j+=h+h)
			for(int k=0;k<h;++k){
				const int x=(ll)y[h+j+k]*w[h+k]%M;
				reduce(y[h+j+k]=y[j+k]-x);
				reduce(y[j+k]+=x-M);
			}
	if (opt==-1){
		int temp=ksm(len,M-2);
		for (int i=0;i<len;i++)y[i]=(ll)y[i]*temp%M;
		reverse(y+1,y+len);
	}
}
inline void solve(int l,int r,int Ans[]){
	if (l==r){
		Ans[0]=1;
		Ans[1]=size[a[l]];
		return;
	}
	int len=1,mid=(l+r)/2;
	while (len<=r-l+2)len<<=1;
	int Ans1[len],Ans2[len];
	memset(Ans1,0,len<<2);memset(Ans2,0,len<<2);memset(Ans,0,len<<2);
	solve(l,mid,Ans1);solve(mid+1,r,Ans2);
	init(len);
	ntt(Ans1,len,1);
	ntt(Ans2,len,1);
	for (int i=0;i<len;i++)Ans[i]=(ll)Ans1[i]*Ans2[i]%M;
	ntt(Ans,len,-1);
}
void jb(int x,int y){
	ne[++tot]=fi[x];
	fi[x]=tot;
	zz[tot]=y;
}
int cmp(int x,int y){
	return size[x]<size[y];
}
void dfs(int x,int y){
	size[x]=1;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y){
			dfs(zz[i],x);
			size[x]+=size[zz[i]];
		}
	int cnt=0;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y)a[cnt++]=zz[i];
	if (!cnt){
		num[x]=1;
		return;
	}
	int len=1;
	while (len<=cnt+2)len<<=1;
	INIT(len);
	solve(0,cnt-1,val);
	for (int j=cnt;j>=0;j--)reduce(val3[j+1]+=(ll)val[j]*(n-size[x])%M-M),reduce(val3[j]+=val[j]-M);
	for (int i=0,j=0;i<cnt;i+=j){
		while (j<cnt&&size[a[i]]==size[a[j]])j++;
		for (int j=cnt+1;j>=0;j--)b[j]=val3[j];
		int V=ksm(size[a[i]],M-2),val2=0;
		for (int j=cnt;j>=0;j--)c[j]=(ll)b[j+1]*V%M,reduce(b[j]-=c[j]);
		for (int j=0;j<=cnt&&j<=m;j++)reduce(val2+=(ll)c[j]*inv[m-j]%M-M);
		val2=(ll)val2*fac[m]%M;
		for (int k=i;k<j;k++)reduce(Ans+=(ll)num[a[k]]*val2%M-M);
	}
	memset(val3,0,(cnt+2)<<2);
	for (int i=0;i<cnt;i++)reduce(Ans+=(ll)num[a[i]]*num[x]%M-M),reduce(num[x]+=num[a[i]]-M);
	int ppp=0;
	for (int i=0;i<=cnt&&i<=m;i++)reduce(ppp+=(ll)inv[m-i]*val[i]%M-M);
	reduce(num[x]+=(ll)ppp*fac[m]%M-M);
}
signed main(){
	scanf("%d%d",&n,&m);
	if (m==1){
		printf("%lld\n",(ll)n*(n-1)/2%M);
		return 0;
	}
	for (int i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		jb(x,y);jb(y,x);
	}
	fac[0]=inv[0]=1;
	for (int i=1;i<=m;i++)fac[i]=(ll)fac[i-1]*i%M,inv[i]=ksm(fac[i],M-2);
	dfs(1,0);
	printf("%d\n",Ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1<<20|1,M=998244353;
int rev[N],w[N],a[N],fac[N],inv[N],n,m,b[N],val[N],val3[N],num[N],Ans,size[N],zz[N],ne[N],tot,x,y,fi[N],c[N];
inline void reduce(int&x){x%=M;x+=M;x%=M;}
inline int ksm(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(ll)x*x%M)
		if (y&1)ans=(ll)ans*x%M;
	return ans;
}
inline void init(int len){
	for (int i=1;i<len;i++)rev[i]=rev[i>>1]>>1|((i&1)*len/2);
}
inline void INIT(int len){
	for (int mid=1;mid<len;mid<<=1){
		const int wn=ksm(3,M/mid/2);w[mid]=1;
		for (int i=1;i<mid;++i)w[i+mid]=(ll)w[i+mid-1]*wn%M;
	}
}
inline void ntt(int y[],int len,int opt){
	for (int i=1;i<len;i++)
		if (rev[i]>i)swap(y[i],y[rev[i]]);
	for (int h=1;h<len;h<<=1)
		for (int j=0;j<len;j+=h+h)
			for(int k=0;k<h;++k){
				const int x=(ll)y[h+j+k]*w[h+k]%M;
				reduce(y[h+j+k]=y[j+k]-x);
				reduce(y[j+k]+=x-M);
			}
	if (opt==-1){
		int temp=ksm(len,M-2);
		for (int i=0;i<len;i++)y[i]=(ll)y[i]*temp%M;
		reverse(y+1,y+len);
	}
}
inline void solve(int l,int r,int Ans[]){
	if (l==r){
		Ans[0]=1;
		Ans[1]=size[a[l]];
		return;
	}
	int len=1,mid=(l+r)/2;
	while (len<=r-l+1)len<<=1;
	int Ans1[len],Ans2[len];
	memset(Ans1,0,len<<2);memset(Ans2,0,len<<2);memset(Ans,0,len<<2);
	solve(l,mid,Ans1);solve(mid+1,r,Ans2);
	init(len);
	ntt(Ans1,len,1);
	ntt(Ans2,len,1);
	for (int i=0;i<len;i++)Ans[i]=(ll)Ans1[i]*Ans2[i]%M;
	ntt(Ans,len,-1);
}
void jb(int x,int y){
	ne[++tot]=fi[x];
	fi[x]=tot;
	zz[tot]=y;
}
int cmp(int x,int y){
	return size[x]<size[y];
}
void dfs(int x,int y){
	size[x]=1;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y){
			dfs(zz[i],x);
			size[x]+=size[zz[i]];
		}
	int cnt=0;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y)a[cnt++]=zz[i];
	if (!cnt){
		num[x]=1;
		return;
	}
	int len=1;
	while (len<=cnt+1)len<<=1;
	INIT(len);
	solve(0,cnt-1,val);
	for (int j=cnt;j>=0;j--)reduce(val3[j+1]+=(ll)val[j]*(n-size[x])%M-M),reduce(val3[j]+=val[j]-M);
	for (int i=0,j=0;i<cnt;i+=j){
		while (j<cnt&&size[a[i]]==size[a[j]])j++;
		for (int j=cnt+1;j>=0;j--)b[j]=val3[j];
		int V=ksm(size[a[i]],M-2),val2=0;
		for (int j=cnt;j>=0;j--)c[j]=(ll)b[j+1]*V%M,reduce(b[j]-=c[j]);
		for (int j=0;j<=cnt&&j<=m;j++)reduce(val2+=(ll)c[j]*inv[m-j]%M-M);
		val2=(ll)val2*fac[m]%M;
		for (int k=i;k<j;k++)reduce(Ans+=(ll)num[a[k]]*val2%M-M);
	}
	memset(val3,0,(cnt+2)<<2);
	for (int i=0;i<cnt;i++)reduce(Ans+=(ll)num[a[i]]*num[x]%M-M),reduce(num[x]+=num[a[i]]-M);
	int ppp=0;
	for (int i=0;i<=cnt&&i<=m;i++)reduce(ppp+=(ll)inv[m-i]*val[i]%M-M);
	reduce(num[x]+=(ll)ppp*fac[m]%M-M);
}
signed main(){
	scanf("%d%d",&n,&m);
	if (m==1){
		printf("%lld\n",(ll)n*(n-1)/2%M);
		return 0;
	}
	for (int i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		jb(x,y);jb(y,x);
	}
	fac[0]=inv[0]=1;
	for (int i=1;i<=m;i++)fac[i]=(ll)fac[i-1]*i%M,inv[i]=ksm(fac[i],M-2);
	dfs(1,0);
	printf("%d\n",Ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1<<21|1,M=998244353;
int rev[N],w[N],a[N],fac[N],inv[N],n,m,b[N],val[N],val3[N],num[N],Ans,size[N],zz[N],ne[N],tot,x,y,fi[N],c[N];
inline void reduce(int&x){x%=M;x+=M;x%=M;}
inline int ksm(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(ll)x*x%M)
		if (y&1)ans=(ll)ans*x%M;
	return ans;
}
inline void init(int len){
	for (int i=1;i<len;i++)rev[i]=rev[i>>1]>>1|((i&1)*len/2);
}
inline void INIT(int len){
	for (int mid=1;mid<len;mid<<=1){
		const int wn=ksm(3,M/mid/2);w[mid]=1;
		for (int i=1;i<mid;++i)w[i+mid]=(ll)w[i+mid-1]*wn%M;
	}
}
inline void ntt(int y[],int len,int opt){
	for (int i=1;i<len;i++)
		if (rev[i]>i)swap(y[i],y[rev[i]]);
	for (int h=1;h<len;h<<=1)
		for (int j=0;j<len;j+=h+h)
			for(int k=0;k<h;++k){
				const int x=(ll)y[h+j+k]*w[h+k]%M;
				reduce(y[h+j+k]=y[j+k]-x);
				reduce(y[j+k]+=x-M);
			}
	if (opt==-1){
		int temp=ksm(len,M-2);
		for (int i=0;i<len;i++)y[i]=(ll)y[i]*temp%M;
		reverse(y+1,y+len);
	}
}
inline void solve(int l,int r,int Ans[]){
	if (l==r){
		Ans[0]=1;
		Ans[1]=size[a[l]];
		return;
	}
	int len=1,mid=(l+r)/2;
	while (len<=r-l+1)len<<=1;
	int Ans1[len],Ans2[len];
	memset(Ans1,0,len<<2);memset(Ans2,0,len<<2);memset(Ans,0,len<<2);
	solve(l,mid,Ans1);solve(mid+1,r,Ans2);
	init(len);
	ntt(Ans1,len,1);
	ntt(Ans2,len,1);
	for (int i=0;i<len;i++)Ans[i]=(ll)Ans1[i]*Ans2[i]%M;
	ntt(Ans,len,-1);
}
void jb(int x,int y){
	ne[++tot]=fi[x];
	fi[x]=tot;
	zz[tot]=y;
}
int cmp(int x,int y){
	return size[x]<size[y];
}
void dfs(int x,int y){
	size[x]=1;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y){
			dfs(zz[i],x);
			size[x]+=size[zz[i]];
		}
	int cnt=0;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y)a[cnt++]=zz[i];
	if (!cnt){
		num[x]=1;
		return;
	}
	int len=1;
	while (len<=cnt+1)len<<=1;
	INIT(len);
	solve(0,cnt-1,val);
	for (int j=cnt;j>=0;j--)reduce(val3[j+1]+=(ll)val[j]*(n-size[x])%M-M),reduce(val3[j]+=val[j]-M);
	for (int i=0,j=0;i<cnt;i+=j){
		while (j<cnt&&size[a[i]]==size[a[j]])j++;
		for (int j=cnt+1;j>=0;j--)b[j]=val3[j];
		int V=ksm(size[a[i]],M-2),val2=0;
		for (int j=cnt;j>=0;j--)c[j]=(ll)b[j+1]*V%M,reduce(b[j]-=c[j]);
		for (int j=0;j<=cnt&&j<=m;j++)reduce(val2+=(ll)c[j]*inv[m-j]%M-M);
		val2=(ll)val2*fac[m]%M;
		for (int k=i;k<j;k++)reduce(Ans+=(ll)num[a[k]]*val2%M-M);
	}
	memset(val3,0,(cnt+2)<<2);
	for (int i=0;i<cnt;i++)reduce(Ans+=(ll)num[a[i]]*num[x]%M-M),reduce(num[x]+=num[a[i]]-M);
	int ppp=0;
	for (int i=0;i<=cnt&&i<=m;i++)reduce(ppp+=(ll)inv[m-i]*val[i]%M-M);
	reduce(num[x]+=(ll)ppp*fac[m]%M-M);
}
signed main(){
	scanf("%d%d",&n,&m);
	if (m==1){
		printf("%lld\n",(ll)n*(n-1)/2%M);
		return 0;
	}
	for (int i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		jb(x,y);jb(y,x);
	}
	fac[0]=inv[0]=1;
	for (int i=1;i<=m;i++)fac[i]=(ll)fac[i-1]*i%M,inv[i]=ksm(fac[i],M-2);
	dfs(1,0);
	printf("%d\n",Ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1<<21|1,M=998244353;
int rev[N],w[N],a[N],fac[N],inv[N],n,m,b[N],val[N],val3[N],num[N],Ans,size[N],zz[N],ne[N],tot,x,y,fi[N],c[N];
inline void reduce(int&x){x+=x>>31&M;}
inline int ksm(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(ll)x*x%M)
		if (y&1)ans=(ll)ans*x%M;
	return ans;
}
inline void init(int len){
	for (int i=1;i<len;i++)rev[i]=rev[i>>1]>>1|((i&1)*len/2);
}
inline void INIT(int len){
	for (int mid=1;mid<len;mid<<=1){
		const int wn=ksm(3,M/mid/2);w[mid]=1;
		for (int i=1;i<mid;++i)w[i+mid]=(ll)w[i+mid-1]*wn%M;
	}
}
inline void ntt(int y[],int len,int opt){
	for (int i=1;i<len;i++)
		if (rev[i]>i)swap(y[i],y[rev[i]]);
	for (int h=1;h<len;h<<=1)
		for (int j=0;j<len;j+=h+h)
			for(int k=0;k<h;++k){
				const int x=(ll)y[h+j+k]*w[h+k]%M;
				reduce(y[h+j+k]=y[j+k]-x);
				reduce(y[j+k]+=x-M);
			}
	if (opt==-1){
		int temp=ksm(len,M-2);
		for (int i=0;i<len;i++)y[i]=(ll)y[i]*temp%M;
		reverse(y+1,y+len);
	}
}
inline void solve(int l,int r,int Ans[]){
	if (l==r){
		Ans[0]=1;
		Ans[1]=size[a[l]];
		return;
	}
	int len=1,mid=(l+r)/2;
	while (len<=r-l+2)len<<=1;
	int Ans1[len],Ans2[len];
	memset(Ans1,0,len<<2);memset(Ans2,0,len<<2);memset(Ans,0,len<<2);
	solve(l,mid,Ans1);solve(mid+1,r,Ans2);
	init(len);
	ntt(Ans1,len,1);
	ntt(Ans2,len,1);
	for (int i=0;i<len;i++)Ans[i]=(ll)Ans1[i]*Ans2[i]%M;
	ntt(Ans,len,-1);
}
void jb(int x,int y){
	ne[++tot]=fi[x];
	fi[x]=tot;
	zz[tot]=y;
}
int cmp(int x,int y){
	return size[x]<size[y];
}
void dfs(int x,int y){
	size[x]=1;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y){
			dfs(zz[i],x);
			size[x]+=size[zz[i]];
		}
	int cnt=0;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y)a[cnt++]=zz[i];
	sort(a,a+cnt,cmp);
	if (!cnt){
		num[x]=1;
		return;
	}
	int len=1;
	while (len<=cnt+2)len<<=1;
	INIT(len);
	solve(0,cnt-1,val);
	for (int j=cnt;j>=0;j--)reduce(val3[j+1]+=(ll)val[j]*(n-size[x])%M-M),reduce(val3[j]+=val[j]-M);
	for (int i=0,j=0;i<cnt;i+=j){
		while (j<cnt&&size[a[i]]==size[a[j]])j++;
		for (int j=cnt+1;j>=0;j--)b[j]=val3[j];
		int V=ksm(size[a[i]],M-2),val2=0;
		for (int j=cnt;j>=0;j--)c[j]=(ll)b[j+1]*V%M,reduce(b[j]-=c[j]);
		for (int j=0;j<=cnt&&j<=m;j++)reduce(val2+=(ll)c[j]*inv[m-j]%M-M);
		val2=(ll)val2*fac[m]%M;
		for (int k=i;k<j;k++)reduce(Ans+=(ll)num[a[k]]*val2%M-M);
	}
	memset(val3,0,(cnt+2)<<2);
	for (int i=0;i<cnt;i++)reduce(Ans+=(ll)num[a[i]]*num[x]%M-M),reduce(num[x]+=num[a[i]]-M);
	int ppp=0;
	for (int i=0;i<=cnt&&i<=m;i++)reduce(ppp+=(ll)inv[m-i]*val[i]%M-M);
	reduce(num[x]+=(ll)ppp*fac[m]%M-M);
}
signed main(){
	scanf("%d%d",&n,&m);
	if (m==1){
		printf("%lld\n",(ll)n*(n-1)/2%M);
		return 0;
	}
	for (int i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		jb(x,y);jb(y,x);
	}
	fac[0]=inv[0]=1;
	for (int i=1;i<=m;i++)fac[i]=(ll)fac[i-1]*i%M,inv[i]=ksm(fac[i],M-2);
	dfs(1,0);
	printf("%d\n",Ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1<<21|1,M=998244353;
int rev[N],w[N],a[N],fac[N],inv[N],n,m,b[N],val[N],val3[N],num[N],Ans,size[N],zz[N],ne[N],tot,x,y,fi[N],c[N];
inline void reduce(int&x){x+=x>>31&M;}
inline int ksm(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(ll)x*x%M)
		if (y&1)ans=(ll)ans*x%M;
	return ans;
}
inline void init(int len){
	for (int i=1;i<len;i++)rev[i]=rev[i>>1]>>1|((i&1)*len/2);
}
inline void INIT(int len){
	for (int mid=1;mid<len;mid<<=1){
		const int wn=ksm(3,M/mid/2);w[mid]=1;
		for (int i=1;i<mid;++i)w[i+mid]=(ll)w[i+mid-1]*wn%M;
	}
}
inline void ntt(int y[],int len,int opt){
	for (int i=1;i<len;i++)
		if (rev[i]>i)swap(y[i],y[rev[i]]);
	for (int h=1;h<len;h<<=1)
		for (int j=0;j<len;j+=h+h)
			for(int k=0;k<h;++k){
				const int x=(ll)y[h+j+k]*w[h+k]%M;
				reduce(y[h+j+k]=y[j+k]-x);
				reduce(y[j+k]+=x-M);
			}
	if (opt==-1){
		int temp=ksm(len,M-2);
		for (int i=0;i<len;i++)y[i]=(ll)y[i]*temp%M;
		reverse(y+1,y+len);
	}
}
inline void solve(int l,int r,int Ans[]){
	if (l==r){
		Ans[0]=1;
		Ans[1]=size[a[l]];
		return;
	}
	int len=1,mid=(l+r)/2;
	while (len<=r-l+2)len<<=1;
	int Ans1[len],Ans2[len];
	memset(Ans1,0,len<<2);memset(Ans2,0,len<<2);memset(Ans,0,len<<2);
	solve(l,mid,Ans1);solve(mid+1,r,Ans2);
	init(len);
	ntt(Ans1,len,1);
	ntt(Ans2,len,1);
	for (int i=0;i<len;i++)Ans[i]=(ll)Ans1[i]*Ans2[i]%M;
	ntt(Ans,len,-1);
}
void jb(int x,int y){
	ne[++tot]=fi[x];
	fi[x]=tot;
	zz[tot]=y;
}
int cmp(int x,int y){
	return size[x]<size[y];
}
void dfs(int x,int y){
	size[x]=1;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y){
			dfs(zz[i],x);
			size[x]+=size[zz[i]];
		}
	int cnt=0;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y)a[cnt++]=zz[i];
	sort(a,a+cnt,cmp);
	if (!cnt){
		num[x]=1;
		return;
	}
	int len=1;
	while (len<=cnt+2)len<<=1;
	INIT(len);
	solve(0,cnt-1,val);
	for (int j=cnt;j>=0;j--)reduce(val3[j+1]+=(ll)val[j]*(n-size[x])%M-M),reduce(val3[j]+=val[j]-M);
	for (int i=0,l=0;i<cnt;i=l){
		while (l<cnt&&size[a[i]]==size[a[l]])l++;
		for (int j=cnt+1;j>=0;j--)b[j]=val3[j];
		int V=ksm(size[a[i]],M-2),val2=0;
		for (int j=cnt;j>=0;j--)c[j]=(ll)b[j+1]*V%M,reduce(b[j]-=c[j]);
		for (int j=0;j<=cnt&&j<=m;j++)reduce(val2+=(ll)c[j]*inv[m-j]%M-M);
		val2=(ll)val2*fac[m]%M;
		for (int k=i;k<l;k++)reduce(Ans+=(ll)num[a[k]]*val2%M-M);
	}
	memset(val3,0,(cnt+2)<<2);
	for (int i=0;i<cnt;i++)reduce(Ans+=(ll)num[a[i]]*num[x]%M-M),reduce(num[x]+=num[a[i]]-M);
	int ppp=0;
	for (int i=0;i<=cnt&&i<=m;i++)reduce(ppp+=(ll)inv[m-i]*val[i]%M-M);
	reduce(num[x]+=(ll)ppp*fac[m]%M-M);
}
signed main(){
	scanf("%d%d",&n,&m);
	if (m==1){
		printf("%lld\n",(ll)n*(n-1)/2%M);
		return 0;
	}
	for (int i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		jb(x,y);jb(y,x);
	}
	fac[0]=inv[0]=1;
	for (int i=1;i<=m;i++)fac[i]=(ll)fac[i-1]*i%M,inv[i]=ksm(fac[i],M-2);
	dfs(1,0);
	printf("%d\n",Ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1<<21|1,M=998244353;
int rev[N],w[N],a[N],fac[N],inv[N],n,m,b[N],val[N],val3[N],num[N],Ans,size[N],zz[N],ne[N],tot,x,y,fi[N],c[N];
inline void reduce(int&x){x+=x>>31&M;}
inline int ksm(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(ll)x*x%M)
		if (y&1)ans=(ll)ans*x%M;
	return ans;
}
inline void init(int len){
	for (int i=1;i<len;i++)rev[i]=rev[i>>1]>>1|((i&1)*len/2);
}
inline void INIT(int len){
	for (int mid=1;mid<len;mid<<=1){
		const int wn=ksm(3,M/mid/2);w[mid]=1;
		for (int i=1;i<mid;++i)w[i+mid]=(ll)w[i+mid-1]*wn%M;
	}
}
inline void ntt(int y[],int len,int opt){
	for (int i=1;i<len;i++)
		if (rev[i]>i)swap(y[i],y[rev[i]]);
	for (int h=1;h<len;h<<=1)
		for (int j=0;j<len;j+=h+h)
			for(int k=0;k<h;++k){
				const int x=(ll)y[h+j+k]*w[h+k]%M;
				reduce(y[h+j+k]=y[j+k]-x);
				reduce(y[j+k]+=x-M);
			}
	if (opt==-1){
		int temp=ksm(len,M-2);
		for (int i=0;i<len;i++)y[i]=(ll)y[i]*temp%M;
		reverse(y+1,y+len);
	}
}
inline void solve(int l,int r,int Ans[]){
	if (l==r){
		Ans[0]=1;
		Ans[1]=size[a[l]];
		return;
	}
	int len=1,mid=(l+r)/2;
	while (len<=r-l+2)len<<=1;
	int Ans1[len],Ans2[len];
	memset(Ans1,0,len<<2);memset(Ans2,0,len<<2);memset(Ans,0,len<<2);
	solve(l,mid,Ans1);solve(mid+1,r,Ans2);
	init(len);
	ntt(Ans1,len,1);
	ntt(Ans2,len,1);
	for (int i=0;i<len;i++)Ans[i]=(ll)Ans1[i]*Ans2[i]%M;
	ntt(Ans,len,-1);
}
void jb(int x,int y){
	ne[++tot]=fi[x];
	fi[x]=tot;
	zz[tot]=y;
}
int cmp(int x,int y){
	return size[x]<size[y];
}
void dfs(int x,int y){
	size[x]=1;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y){
			dfs(zz[i],x);
			size[x]+=size[zz[i]];
		}
	int cnt=0;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y)a[cnt++]=zz[i];
	if (!cnt){
		num[x]=1;
		return;
	}
	int len=1;
	while (len<=cnt+2)len<<=1;
	INIT(len);
	solve(0,cnt-1,val);
	for (int j=cnt;j>=0;j--)reduce(val3[j+1]+=(ll)val[j]*(n-size[x])%M-M),reduce(val3[j]+=val[j]-M);
	for (int i=0,j=0;i<cnt;i+=j){
		while (j<cnt&&size[a[i]]==size[a[j]])j++;
		for (int j=cnt+1;j>=0;j--)b[j]=val3[j];
		int V=ksm(size[a[i]],M-2),val2=0;
		for (int j=cnt;j>=0;j--)c[j]=(ll)b[j+1]*V%M,reduce(b[j]-=c[j]);
		for (int j=0;j<=cnt&&j<=m;j++)reduce(val2+=(ll)c[j]*inv[m-j]%M-M);
		val2=(ll)val2*fac[m]%M;
		for (int k=i;k<j;k++)reduce(Ans+=(ll)num[a[k]]*val2%M-M);
	}
	memset(val3,0,(cnt+2)<<2);
	for (int i=0;i<cnt;i++)reduce(Ans+=(ll)num[a[i]]*num[x]%M-M),reduce(num[x]+=num[a[i]]-M);
	int ppp=0;
	for (int i=0;i<=cnt&&i<=m;i++)reduce(ppp+=(ll)inv[m-i]*val[i]%M-M);
	reduce(num[x]+=(ll)ppp*fac[m]%M-M);
}
signed main(){
	scanf("%d%d",&n,&m);
	if (m==1){
		printf("%lld\n",(ll)n*(n-1)/2%M);
		return 0;
	}
	for (int i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		jb(x,y);jb(y,x);
	}
	fac[0]=inv[0]=1;
	for (int i=1;i<=m;i++)fac[i]=(ll)fac[i-1]*i%M,inv[i]=ksm(fac[i],M-2);
	dfs(1,0);
	printf("%d\n",Ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
const int N=1<<21|1,M=998244353;
int rev[N],w[N],a[N],fac[N],inv[N],n,m,b[N],val[N],val3[N],num[N],Ans,size[N],zz[N],ne[N],tot,x,y,fi[N],c[N];
inline void reduce(int&x){x%=M;x+=M;x%=M;}
inline int ksm(int x,int y){
	int ans=1;
	for (;y;y>>=1,x=(ll)x*x%M)
		if (y&1)ans=(ll)ans*x%M;
	return ans;
}
inline void init(int len){
	for (int i=1;i<len;i++)rev[i]=rev[i>>1]>>1|((i&1)*len/2);
}
inline void INIT(int len){
	for (int mid=1;mid<len;mid<<=1){
		const int wn=ksm(3,M/mid/2);w[mid]=1;
		for (int i=1;i<mid;++i)w[i+mid]=(ll)w[i+mid-1]*wn%M;
	}
}
inline void ntt(int y[],int len,int opt){
	for (int i=1;i<len;i++)
		if (rev[i]>i)swap(y[i],y[rev[i]]);
	for (int h=1;h<len;h<<=1)
		for (int j=0;j<len;j+=h+h)
			for(int k=0;k<h;++k){
				const int x=(ll)y[h+j+k]*w[h+k]%M;
				reduce(y[h+j+k]=y[j+k]-x);
				reduce(y[j+k]+=x-M);
			}
	if (opt==-1){
		int temp=ksm(len,M-2);
		for (int i=0;i<len;i++)y[i]=(ll)y[i]*temp%M;
		reverse(y+1,y+len);
	}
}
inline void solve(int l,int r,int Ans[]){
	if (l==r){
		Ans[0]=1;
		Ans[1]=size[a[l]];
		return;
	}
	int len=1,mid=(l+r)/2;
	while (len<=r-l+2)len<<=1;
	int Ans1[len],Ans2[len];
	memset(Ans1,0,len<<3);memset(Ans2,0,len<<3);memset(Ans,0,len<<3);
	solve(l,mid,Ans1);solve(mid+1,r,Ans2);
	init(len);
	ntt(Ans1,len,1);
	ntt(Ans2,len,1);
	for (int i=0;i<len;i++)Ans[i]=(ll)Ans1[i]*Ans2[i]%M;
	ntt(Ans,len,-1);
}
void jb(int x,int y){
	ne[++tot]=fi[x];
	fi[x]=tot;
	zz[tot]=y;
}
int cmp(int x,int y){
	return size[x]<size[y];
}
void dfs(int x,int y){
	size[x]=1;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y){
			dfs(zz[i],x);
			size[x]+=size[zz[i]];
		}
	int cnt=0;
	for (int i=fi[x];i;i=ne[i])
		if (zz[i]!=y)a[cnt++]=zz[i];
	if (!cnt){
		num[x]=1;
		return;
	}
	int len=1;
	while (len<=cnt+2)len<<=1;
	INIT(len);
	solve(0,cnt-1,val);
	for (int j=cnt;j>=0;j--)reduce(val3[j+1]+=(ll)val[j]*(n-size[x])%M-M),reduce(val3[j]+=val[j]-M);
	for (int i=0,j=0;i<cnt;i+=j){
		while (j<cnt&&size[a[i]]==size[a[j]])j++;
		for (int j=cnt+1;j>=0;j--)b[j]=val3[j];
		int V=ksm(size[a[i]],M-2),val2=0;
		for (int j=cnt;j>=0;j--)c[j]=(ll)b[j+1]*V%M,reduce(b[j]-=c[j]);
		for (int j=0;j<=cnt&&j<=m;j++)reduce(val2+=(ll)c[j]*inv[m-j]%M-M);
		val2=(ll)val2*fac[m]%M;
		for (int k=i;k<j;k++)reduce(Ans+=(ll)num[a[k]]*val2%M-M);
	}
	memset(val3,0,(cnt+2)<<3);
	for (int i=0;i<cnt;i++)reduce(Ans+=(ll)num[a[i]]*num[x]%M-M),reduce(num[x]+=num[a[i]]-M);
	int ppp=0;
	for (int i=0;i<=cnt&&i<=m;i++)reduce(ppp+=(ll)inv[m-i]*val[i]%M-M);
	reduce(num[x]+=(ll)ppp*fac[m]%M-M);
}
signed main(){
	scanf("%lld%lld",&n,&m);
	if (m==1){
		printf("%lld\n",(ll)n*(n-1)/2%M);
		return 0;
	}
	for (int i=1;i<n;i++){
		scanf("%lld%lld",&x,&y);
		jb(x,y);jb(y,x);
	}
	fac[0]=inv[0]=1;
	for (int i=1;i<=m;i++)fac[i]=(ll)fac[i-1]*i%M,inv[i]=ksm(fac[i],M-2);
	dfs(1,0);
	printf("%lld\n",Ans);
	return 0;
}


#include<cstdio>
#include<vector>
using namespace std;
const int mod=998244353;
const int N=262150;
typedef pair<int,int> pr;
int n,K,x,y,Ans;
int siz[N],f[N],fs[N],fac[N],inv[N];
int rnk[N],f1[N],f2[N],g1[N],g2[N],F[N],G[N];
vector<int>vp1[N],vp2[N];
vector<pr>vec[N];
int to[N],las[N],fir[N],cnt;
inline void add_edge(int u,int v){
	to[++cnt]=v;las[cnt]=fir[u];fir[u]=cnt;
	to[++cnt]=u;las[cnt]=fir[v];fir[v]=cnt;
}
int ksm(int u,int v){
	int res=1;
	for(;v;v>>=1,u=1ll*u*u%mod)
	if(v&1)res=1ll*res*u%mod;
	return res;
}
void pre(int u){
	fac[0]=fac[1]=inv[0]=inv[1]=1;
	for(int i=2;i<=u;i++)fac[i]=1ll*fac[i-1]*i%mod;
	inv[u]=ksm(fac[u],mod-2);
	for(int i=u-1;i>=2;i--)inv[i]=1ll*inv[i+1]*(i+1)%mod;
}
inline int _(int u){return u<mod?u:u-mod;}
inline int __(int u){return u<0?u+mod:u;}
void ntt(int *t,int len,int opt){
	int g=3,g_=ksm(g,mod-2);
	for(int i=0;i<len;i++)if(i<rnk[i])swap(t[i],t[rnk[i]]);
	for(int i=1;i<len;i<<=1){
		int wn=ksm(~opt?g:g_,(mod-1)/(i<<1));
		for(int j=0,J=i<<1;j<len;j+=J){
			int w=1;
			for(int k=j;k<i+j;k++,w=1ll*w*wn%mod){
				int r=1ll*t[i+k]*w%mod;
				t[i+k]=__(t[k]-r);
				t[k]=_(t[k]+r);
			}
		}
	}
	if(~opt)return;
	int ny=ksm(len,mod-2);
	for(int i=0;i<len;i++)t[i]=1ll*t[i]*ny%mod;
}
void solve(int l,int r,int c){
	if(l==r){
		vp1[l].resize(2);
		vp1[l][0]=1;
		vp1[l][1]=vec[c][l].second;
		vp2[l].resize(2);
		vp2[l][0]=f[vec[c][l].first]+fs[vec[c][l].first];
		vp2[l][1]=1ll*(f[vec[c][l].first]+fs[vec[c][l].first])*(n-siz[c])%mod;
		return;
	}
	int m=l+r>>1;
	solve(l,m,c);solve(m+1,r,c);m++;
	for(int i=0;i<vp1[l].size();i++)f1[i]=vp1[l][i];
	for(int i=0;i<vp1[m].size();i++)f2[i]=vp1[m][i];
	for(int i=0;i<vp2[l].size();i++)g1[i]=vp2[l][i];
	for(int i=0;i<vp2[m].size();i++)g2[i]=vp2[m][i];
	int len=1,_2=-1,Len=vp1[l].size()+vp1[m].size()-1;
	while(len<Len)len<<=1,_2++;
	for(int i=0;i<len;i++)rnk[i]=(rnk[i>>1]>>1)|((i&1)<<_2);
	for(int i=vp1[l].size();i<len;i++)f1[i]=0;
	for(int i=vp1[m].size();i<len;i++)f2[i]=0;
	for(int i=vp2[l].size();i<len;i++)g1[i]=0;
	for(int i=vp2[m].size();i<len;i++)g2[i]=0;
	ntt(f1,len,1);ntt(f2,len,1);ntt(g1,len,1);ntt(g2,len,1);
	for(int i=0;i<len;i++)F[i]=1ll*f1[i]*f2[i]%mod;
	for(int i=0;i<len;i++)G[i]=_(1ll*f1[i]*g2[i]%mod+1ll*f2[i]*g1[i]%mod);
	ntt(F,len,-1);ntt(G,len,-1);
	vp1[l].resize(Len);vp2[l].resize(Len);
	for(int i=0;i<Len;i++)vp1[l][i]=F[i];
	for(int i=0;i<Len;i++)vp2[l][i]=G[i];
}
void dfs(int u,int v){
	siz[u]=1;
	for(int i=fir[u];i;i=las[i])
	if(to[i]!=v){
		dfs(to[i],u);siz[u]+=siz[to[i]];
		vec[u].push_back(pr(to[i],siz[to[i]]));
		fs[u]+=fs[to[i]]+f[to[i]];
	}
	if(!vec[u].size())vec[u].push_back(pr(0,0));
	solve(0,vec[u].size()-1,u);
	for(int i=0;i<=min(K,(int)vp1[0].size()-1);i++)
	f[u]=_(f[u]+1ll*vp1[0][i]*fac[K]%mod*inv[K-i]%mod);
	x=_(x+f[u]);y=_(y+1ll*f[u]*f[u]%mod);
	Ans=__(Ans-1ll*f[u]*fs[u]%mod);
	for(int i=0;i<=min(K,(int)vp2[0].size()-1);i++)
	Ans=_(Ans+1ll*vp2[0][i]*fac[K]%mod*inv[K-i]%mod);
}
int main(){
	scanf("%d%d",&n,&K);
	if(K==1){printf("%d\n",1ll*n*(n-1)%mod*ksm(2,mod-2)%mod);return 0;}
	for(int i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		add_edge(x,y);
	}
	pre(K);x=y=0;
	dfs(1,1);
	printf("%d\n",_(Ans+1ll*__(1ll*x*x%mod-y)*ksm(2,mod-2)%mod));
}


#include<cstdio>
#include<vector>
using namespace std;
const int mod=998244353;
const int N=262150;
typedef pair<int,int> pr;
int n,K,x,y,Ans;
int siz[N],f[N],fs[N],fac[N],inv[N];
int rnk[N],f1[N],f2[N],g1[N],g2[N],F[N],G[N];
vector<int>vp1[N],vp2[N];
vector<pr>vec[N];
int to[N],las[N],fir[N],cnt;
inline void add_edge(int u,int v){
	to[++cnt]=v;las[cnt]=fir[u];fir[u]=cnt;
	to[++cnt]=u;las[cnt]=fir[v];fir[v]=cnt;
}
int ksm(int u,int v){
	int res=1;
	for(;v;v>>=1,u=1ll*u*u%mod)
	if(v&1)res=1ll*res*u%mod;
	return res;
}
void pre(int u){
	fac[0]=fac[1]=inv[0]=inv[1]=1;
	for(int i=2;i<=u;i++)fac[i]=1ll*fac[i-1]*i%mod;
	inv[u]=ksm(fac[u],mod-2);
	for(int i=u-1;i>=2;i--)inv[i]=1ll*inv[i+1]*(i+1)%mod;
}
inline int _(int u){return u<mod?u:u-mod;}
inline int __(int u){return u<0?u+mod:u;}
void ntt(int *t,int len,int opt){
	int g=3,g_=ksm(g,mod-2);
	for(int i=0;i<len;i++)if(i<rnk[i])swap(t[i],t[rnk[i]]);
	for(int i=1;i<len;i<<=1){
		int wn=ksm(~opt?g:g_,(mod-1)/(i<<1));
		for(int j=0,J=i<<1;j<len;j+=J){
			int w=1;
			for(int k=j;k<i+j;k++,w=1ll*w*wn%mod){
				int r=1ll*t[i+k]*w%mod;
				t[i+k]=__(t[k]-r);
				t[k]=_(t[k]+r);
			}
		}
	}
	if(~opt)return;
	int ny=ksm(len,mod-2);
	for(int i=0;i<len;i++)t[i]=1ll*t[i]*ny%mod;
}
void solve(int l,int r,int c){
	if(l==r){
		vp1[l].resize(2);
		vp1[l][0]=1;
		vp1[l][1]=vec[c][l].second;
		vp2[l].resize(2);
		vp2[l][0]=_(f[vec[c][l].first]+fs[vec[c][l].first]);
		vp2[l][1]=1ll*(f[vec[c][l].first]+fs[vec[c][l].first])*(n-siz[c])%mod;
		return;
	}
	int m=l+r>>1;
	solve(l,m,c);solve(m+1,r,c);m++;
	for(int i=0;i<vp1[l].size();i++)f1[i]=vp1[l][i];
	for(int i=0;i<vp1[m].size();i++)f2[i]=vp1[m][i];
	for(int i=0;i<vp2[l].size();i++)g1[i]=vp2[l][i];
	for(int i=0;i<vp2[m].size();i++)g2[i]=vp2[m][i];
	int len=1,_2=-1,Len=vp1[l].size()+vp1[m].size()-1;
	while(len<Len)len<<=1,_2++;
	for(int i=0;i<len;i++)rnk[i]=(rnk[i>>1]>>1)|((i&1)<<_2);
	for(int i=vp1[l].size();i<len;i++)f1[i]=0;
	for(int i=vp1[m].size();i<len;i++)f2[i]=0;
	for(int i=vp2[l].size();i<len;i++)g1[i]=0;
	for(int i=vp2[m].size();i<len;i++)g2[i]=0;
	ntt(f1,len,1);ntt(f2,len,1);ntt(g1,len,1);ntt(g2,len,1);
	for(int i=0;i<len;i++)F[i]=1ll*f1[i]*f2[i]%mod;
	for(int i=0;i<len;i++)G[i]=_(1ll*f1[i]*g2[i]%mod+1ll*f2[i]*g1[i]%mod);
	ntt(F,len,-1);ntt(G,len,-1);
	vp1[l].resize(Len);vp2[l].resize(Len);
	for(int i=0;i<Len;i++)vp1[l][i]=F[i];
	for(int i=0;i<Len;i++)vp2[l][i]=G[i];
}
void dfs(int u,int v){
	siz[u]=1;
	for(int i=fir[u];i;i=las[i])
	if(to[i]!=v){
		dfs(to[i],u);siz[u]+=siz[to[i]];
		vec[u].push_back(pr(to[i],siz[to[i]]));
		fs[u]=_(fs[u]+_(fs[to[i]]+f[to[i]]));
	}
	if(!vec[u].size())vec[u].push_back(pr(0,0));
	solve(0,vec[u].size()-1,u);
	for(int i=0;i<=min(K,(int)vp1[0].size()-1);i++)
	f[u]=_(f[u]+1ll*vp1[0][i]*fac[K]%mod*inv[K-i]%mod);
	x=_(x+f[u]);y=_(y+1ll*f[u]*f[u]%mod);
	Ans=__(Ans-1ll*f[u]*fs[u]%mod);
	for(int i=0;i<=min(K,(int)vp2[0].size()-1);i++)
	Ans=_(Ans+1ll*vp2[0][i]*fac[K]%mod*inv[K-i]%mod);
}
int main(){
	scanf("%d%d",&n,&K);
	if(K==1){printf("%d\n",1ll*n*(n-1)%mod*ksm(2,mod-2)%mod);return 0;}
	for(int i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		add_edge(x,y);
	}
	pre(K);x=y=0;
	dfs(1,1);
	printf("%d\n",_(Ans+1ll*__(1ll*x*x%mod-y)*ksm(2,mod-2)%mod));
}


#include <bits/stdc++.h>
#define mk make_pair
#define ll long long
using namespace std;
#define complex ccc
const int N = 3e5 + 5;
const int mod = 998244353;
const int g = 3;
int Pow(ll a, int x, const int &mod) {
	ll res = 1;
	while (x) {
		if (x & 1) (res *= a) %= mod;
		(a *= a) %= mod;
		x >>= 1;
	}
	return res;
}
void NTT(int *a, int n, int rev) {
	for (int i = 0, j = 0; i < n; ++i) {
		if (i > j) swap(a[i], a[j]);
		for (int k = n >> 1; (j ^= k) < k; k >>= 1);
	}
	for (int i = 2; i <= n; i <<= 1) {
		int m = i >> 1;
		int w = Pow(g, (mod - 1) / i, mod);
		if (rev == -1) w = Pow(w, mod - 2, mod);
		for (int j = 0; j < n; j += i) {
			ll Wx = 1;
			for (int k = 0; k != m; k++) {
				ll z = a[j + m + k] * Wx % mod;
				a[j + m + k] = a[j + k] - z + mod;
				if (a[j + m + k] >= mod) a[j + m + k] -= mod;
				a[j + k] = a[j + k] + z;
				if (a[j + k] >= mod) a[j + k] -= mod;
				Wx = Wx * w % mod;
			}
		}
	}
	if (rev == -1) {
		ll inv = Pow(n, mod - 2, mod);
		for (int i = 0; i < n; i++) a[i] = a[i] * inv % mod;
	}
}
int len, A[N], B[N];
int n, k, size[N];
vector<int> G[N];
vector<int> poly[N];
ll ans, sum, F[N], sumF[N];
ll fac[N], inv[N];
vector<int> calc(vector<int> &sz) {
	vector<int> res;
	res.resize(sz.size() + 1);
	if (sz.size() == 0) {
		res[0] = 1;
		return res;
	}
	if (sz.size() == 1) {
		res[0] = 1;
		res[1] = sz[0];
		return res;
	}
	int mid = sz.size() >> 1;
	vector<int> l, r;
	for (int i = 0; i < mid; ++i) l.push_back(sz[i]);
	for (int i = mid; i < sz.size(); ++i) r.push_back(sz[i]);
	l = calc(l);
	r = calc(r);
	len = 1;
	while (len <= l.size() + r.size() - 2) len <<= 1;
	for (int i = 0; i < len; ++i) A[i] = B[i] = 0;
	for (int i = 0; i < l.size(); ++i) A[i] = l[i];
	for (int i = 0; i < r.size(); ++i) B[i] = r[i];
	NTT(A, len, 1); NTT(B, len, 1);
	for (int i = 0; i < len; ++i) A[i] = (ll)A[i] * B[i] % mod;
	NTT(A, len, -1);
	for (int i = 0; i <= sz.size(); ++i) res[i] = A[i];
	return res;
}
void dfs(int x, int f) {
	size[x] = 1;
	vector<int> V;
	for (int u: G[x]) {
		if (u == f) continue;
		dfs(u, x);
		size[x] += size[u];
		V.push_back(size[u]);
		sumF[x] += sumF[u];
		if (sumF[x] >= mod) sumF[x] -= mod;
	}
	poly[x] = calc(V);
	for (int i = 0; i < poly[x].size(); ++i) {
		if (i > k) break;
		F[x] += poly[x][i] * fac[k] % mod * inv[k - i];
		F[x] %= mod;
	}
	sum += F[x];
	if (sum >= mod) sum -= mod;
	//cout << x << "," << F[x] << endl;
	//for (int i = 0; i < poly[x].size(); ++i) cout << poly[x][i] << "/"; cout << endl;
	sumF[x] += F[x];
	if (sumF[x] >= mod) sumF[x] -= mod;
}
void div(vector<int> &p, int s) {
	vector<int> q;
	q.resize(p.size() - 1);
	s = fac[s - 1] * inv[s] % mod;
	for (int i = q.size() - 1; i >= 0; --i) {
		q[i] = (ll)p[i + 1] * s % mod;
		p[i] += mod - q[i];
		if (p[i] >= mod) p[i] -= mod;
	}
	p = q;
}
void mul(vector<int> &p, int s) {
	p.push_back(0);
	for (int i = p.size() - 2; i >= 0; --i) {
		p[i + 1] += (ll)p[i] * s % mod;
		if (p[i + 1] >= mod) p[i + 1] -= mod;
	}
}
ll value(vector<int> &poly) {
	ll res = 0;
	for (int i = 0; i < poly.size(); ++i) {
		if (i > k) break;
		res += poly[i] * fac[k] % mod * inv[k - i];
		res %= mod;
	}
	return res;
}
void add(vector<int> &poly) {
	for (int i = 0; i < poly.size(); ++i) {
		if (i > k) break;
		sum += poly[i] * fac[k] % mod * inv[k - i];
		sum %= mod;
	}
}
void sub(vector<int> &poly) {
	for (int i = 0; i < poly.size(); ++i) {
		if (i > k) break;
		sum += (ll)mod * mod - poly[i] * fac[k] % mod * inv[k - i];
		sum %= mod;
	}
}
void dfs2(int x, int f) {
	sort(G[x].begin(), G[x].end(), [](int i, int j) {
		return size[i] < size[j];
	});
	if (f)
		G[x].erase(find(G[x].begin(), G[x].end(), f));
	int presize = -1;
	for (int i = 0; i < G[x].size(); ++i) {
		int uu, u = G[x][i];
		ll presum = sum;//cout << x << "," << sum << ","; for (int i = 0; i < poly[x].size(); ++i) cout << poly[x][i] << "/"; cout << endl;
		sub(poly[x]);  //cout << x << "," << sum << "/";
		div(poly[x], size[u]);
		if (x != 1)
			mul(poly[x], n - size[x]);
		add(poly[x]);
		ans += F[u] * (sum - sumF[u] + mod);
		ans %= mod;  //cout << u << "," << (sum - sumF[u] + mod) % mod << "/";
		ll tmp = value(poly[x]);
		ans += tmp * sumF[u]; //cout << (F[1] + mod - presum + sum) % mod << "/";
		ans %= mod;
		dfs2(u, x);
		while (i + 1 < G[x].size() && size[uu = G[x][i + 1]] == size[u]) {
			ans += F[uu] * (sum - sumF[uu] + mod);
			ans %= mod;//cout << (sum - sumF[u] + mod) % mod << "/";
			ans += tmp * sumF[uu];
			ans %= mod;
			dfs2(uu, x);
			++i;
		}
		mul(poly[x], size[u]);
		if (x != 1)
			div(poly[x], n - size[x]);
		sum = presum;
	}
}// 7 2 1 2 1 3 2 4 2 5 3 6 3 7
int main() {
	cin >> n >> k;
	for (int i = 1; i < n; ++i) {
		int x, y;
		scanf("%d %d", &x, &y);
		G[x].push_back(y);
		G[y].push_back(x);
	}
	if (k == 1) {
		cout << (ll)n * (n - 1) / 2 % mod << endl;
		return 0;
	}
	fac[0] = 1;
	for (int i = 1; i < N; ++i) fac[i] = fac[i - 1] * i % mod;
	inv[N - 1] = Pow(fac[N - 1], mod - 2, mod);
	for (int i = N - 2; i >= 0; --i) inv[i] = inv[i + 1] * (i + 1) % mod; //cout << fac[1] * inv[2] * 2 % mod << "/";
	dfs(1, 0);
	dfs2(1, 0);
	cout << ans * Pow(2, mod - 2, mod) % mod;
}


 #include<cstdio>
#include<algorithm>
#define rep(i,s,t) for(register int i=s;i<=t;++i)
#define _rep(i,s,t) for(register int i=s;i>=t;--i)
using namespace std;
#define gi(x) read(x)
#define gii(x,y) read(x),read(y)
#define giii(x,y,z) read(x),read(y),read(z)
#define ms(f,x) memset(f,x,sizeof f)
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
namespace IO{
    #define gc getchar()
    #define pc(x) putchar(x)
    template<typename T>inline void read(T &x){
        x=0;int f=1;char ch=gc;while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=gc;}
        while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=gc;x*=f;return;
    }
    template<typename T>inline void write(T x=0){
        T wr[51];wr[0]=0;if(x<0)pc('-'),x=-x;if(!x)pc(48);
        while(x)wr[++wr[0]]=x%10,x/=10;while(wr[0])pc(48+wr[wr[0]--]);return;
    }
}
using IO::read;
using IO::write;
const int N=1e6+11,mod=998244353;
int n,k,tot,x,y,ans;
int nxt[N],las[N],to[N],f[N],g[N],fac[N],ifac[N],sum[N],sz[N];
inline void inc(int &x,int y){
	x+=y;
	if(x>=mod)
		x-=mod;
}
inline int fp(int a,int b){
	if(b<0)b+=mod-1;
	int res=1;
	for(;b;b>>=1,a=1ll*a*a%mod)
		if(b&1)
			res=1ll*res*a%mod;
	return res;
}
inline int C(int n,int m){
	return 1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}
inline int A(int n,int m){
	return 1ll*fac[n]*ifac[n-m]%mod;
}
inline void init(int n){
	fac[0]=1;
	rep(i,1,n)
		fac[i]=1ll*i*fac[i-1]%mod;
	ifac[n]=fp(fac[n],mod-2);
	_rep(i,n,1)
		ifac[i-1]=1ll*i*ifac[i]%mod;
}
inline void add(int x,int y){
	nxt[++tot]=las[x];
	las[x]=tot;
	to[tot]=y;
}
int len,cnt,s;
int val[N],tmpa[17][N],tmpb[17][N],*a,*b,tmp[N],p[N],d[N];
inline void dft(int *a,int n,int f){
	rep(i,0,n-1)
		if(i<p[i])
			swap(a[i],a[p[i]]);
	for(register int i=1;i<n;i<<=1){
		int gn=fp(3,(mod-1)/(i<<1)*f);
		for(register int j=0,g=1,x,y;g=1,j<n;j+=(i<<1)){
			for(register int k=j;k<i+j;++k,g=1ll*g*gn%mod){
				x=a[k],y=1ll*g*a[i+k]%mod;
				a[k]=(x+y)%mod,a[i+k]=(x+mod-y)%mod;
			}
		}
	}
	if(f==-1){
		int inv=fp(n,mod-2);
		rep(i,0,n-1)
			a[i]=1ll*a[i]*inv%mod;
	}
}
inline void solve(int l,int r,int *ret,int dep){
    if(l==r){
		ret[0]=1,ret[1]=val[l];
        return;
    }
    int mid=(l+r)>>1,tmp=r-l+2,lg2=-1,d=1;
    solve(l,mid,tmpa[dep],dep+1),solve(mid+1,r,tmpb[dep],dep+1);
    a=tmpa[dep],b=tmpb[dep];
    while(d<=tmp+tmp)d<<=1,++lg2;
    rep(i,0,d-1)
    	p[i]=(p[i>>1]>>1)^((i&1)<<lg2);
    dft(a,d,1),dft(b,d,1);
    rep(i,0,d-1)
    	a[i]=1ll*a[i]*b[i]%mod;
    dft(a,d,-1);
    rep(i,0,d-1)
    	ret[i]=a[i],b[i]=a[i]=0;
}
inline int calc(int n){
	int ans=0,o=min(n,k);
	rep(i,0,o)
		ans=(ans+1ll*tmp[i]*A(k,i))%mod;
	return ans;
}
inline void mul(int x){
	_rep(i,len,0)
		tmp[i+1]=(tmp[i+1]+1ll*x*tmp[i])%mod;
	++len;
}
inline void div(int x){
	int inv=fp(x,mod-2);
	rep(i,0,len)
		d[i]=tmp[i],tmp[i]=0;
	_rep(i,len,1)
		if(d[i]){
			tmp[i-1]=1ll*d[i]*inv%mod;
			inc(d[i-1],mod-tmp[i-1]);
		}
	rep(i,0,len)d[i]=0;
	--len;
}
inline bool cmp(int x,int y){
	return sz[x]<sz[y];
}
inline void dfs(int x,int fa){
	sz[x]=1;
	for(register int e=las[x];e;e=nxt[e]){
		if(to[e]==fa)continue;
		dfs(to[e],x);
		sz[x]+=sz[to[e]];
		inc(sum[x],sum[to[e]]);
	}
	len=0;
	for(register int e=las[x];e;e=nxt[e]){
		if(to[e]==fa)continue;
		val[++len]=sz[to[e]];
	}
	if(!len)f[x]=1;
	else{
		cnt=0;
		solve(1,len,tmp,0);
		f[x]=calc(len);
		for(register int e=las[x];e;e=nxt[e]){
			if(to[e]==fa)continue;
			val[++cnt]=to[e];
		}
		sort(val+1,val+cnt+1,cmp);
		mul(n-sz[x]);
		rep(i,1,cnt){
			if(sz[val[i]]==sz[val[i-1]])
				g[val[i]]=g[val[i-1]];
			else{
				div(sz[val[i]]);
				g[val[i]]=calc(len);
				mul(sz[val[i]]);
			}
		}
		rep(i,0,len)
			tmp[i]=0;
	}
	inc(sum[x],f[x]);
	for(register int e=las[x];e;e=nxt[e]){
		if(to[e]==fa)continue;
		ans=(ans+2ll*(g[to[e]]-f[x])*sum[to[e]])%mod;
	}
	ans=(ans-1ll*f[x]*f[x])%mod;
}
int main(){
	gii(n,k);
	if(k==1){
		printf("%lld\n",1ll*n*(n-1)/2%mod);
		return 0;
	}
	rep(i,2,n){
		gii(x,y),
		add(x,y),add(y,x);
	}
	init(1e5);
	dfs(1,0);
	ans=(ans+1ll*sum[1]*sum[1])%mod;
	ans=1ll*ans*ifac[2]%mod;
	ans=(ans+mod)%mod;
	printf("%d\n",ans);
	return 0;
}


#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define gt getchar()
#define ll long long
#define File(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
inline int in()
{
	int k=0;char ch=gt;
	while(ch<'-')ch=gt;
	while(ch>'-')k=k*10+ch-'0',ch=gt;
	return k;
}
const int YL=998244353,N=4e5+5;
int rev[N];std::vector<int>G[N],fz[N];
inline int MO(const int &x){return x>=YL?x-YL:x;}
inline int OD(const int &x){return x< 0 ?x+YL:x;}
inline int ksm(int a,int k){int r=1;while(k){if(k&1)r=1ll*r*a%YL;a=1ll*a*a%YL,k>>=1;}return r;}
inline void init(int L){for(int i=1;i<L;++i)rev[i]=(rev[i>>1]>>1)|(i&1?L>>1:0);}
#define Wn ksm(3,opt==1?(YL-1)/st:YL-1-(YL-1)/st)

void ntt(int *a,int len,int opt=1)
{
	for(int i=0;i<len;++i)if(i<rev[i])std::swap(a[i],a[rev[i]]);
	for(int st=2,m=1;st<=len;st<<=1,m<<=1)
		for(int *p=a,x,y,wn=Wn;p!=a+len;p+=st)
			for(int k=0,wnk=1;k<m;++k,wnk=1ll*wnk*wn%YL)
				x=p[k],y=1ll*wnk*p[k+m]%YL,p[k+m]=OD(x-y),p[k]=MO(x+y);
	if(opt==1)return;int inv=ksm(len,YL-2);
	for(int i=0;i<len;++i)a[i]=1ll*a[i]*inv%YL;
}

void mul(int *a,int *b,int *c,int len)
{
	static int A[N],B[N];init(len);
	memcpy(A,a,len<<2),memcpy(B,b,len<<2);
	ntt(A,len),ntt(B,len);
	for(int i=0;i<len;++i)c[i]=1ll*A[i]*B[i]%YL;
	ntt(c,len,-1);
}

int B[50][N],st[50],top;
int solve(std::vector<int> &fz,int l,int r)
{
	int now=st[top--];
	if(l==r)return B[now][0]=1,B[now][1]=fz[l],now;
	int mid=l+r>>1,lc=solve(fz,l,mid),rc=solve(fz,mid+1,r);
	int L=r-l+2,len=1;while(len<=L)len<<=1;
	mul(B[lc],B[rc],B[now],len);
	memset(B[lc],0,len<<2),memset(B[rc],0,len<<2);
	st[++top]=lc,st[++top]=rc;return now;
}

int head[N],to[N<<1],nxt[N<<1],cnt,n,k,sum[N],siz[N],fac[N],fnv[N],ans;
inline int A(int x,int y){return y>x?0:1ll*fac[x]*fnv[x-y]%YL;}
inline void add(int u,int v)
{
	nxt[++cnt]=head[u],to[head[u]=cnt]=v;
	nxt[++cnt]=head[v],to[head[v]=cnt]=u;
}

inline void mul(int *a,int &deg,int x)
{++deg;for(int i=deg;i;--i)a[i]=(1ll*a[i-1]*x+a[i])%YL;}
inline void div(int *a,int &deg,int x)
{for(int i=1;i<=deg;++i)a[i]=OD(a[i]-1ll*a[i-1]*x%YL);--deg;}

void dfs(int u,int pa=0)
{
	siz[u]=1;int tot=0;fz[u].push_back(0);
	for(int i=head[u],v;i;i=nxt[i])
		if((v=to[i])!=pa)
		{
			dfs(v,u),siz[u]+=siz[v],fz[u].push_back(siz[v]),G[siz[v]].push_back(v);
			ans=(1ll*sum[u]*sum[v]+ans)%YL,sum[u]=MO(sum[u]+sum[v]),++tot;
		}
	if(!tot)return sum[u]=1,void();int now=solve(fz[u],1,tot),res=0;
	for(int i=0;i<=tot;++i)sum[u]=(1ll*B[now][i]*A(k,i)+sum[u])%YL;
	std::sort(fz[u].begin()+1,fz[u].end());
	int s=std::unique(fz[u].begin()+1,fz[u].end())-fz[u].begin()-1;
	mul(B[now],tot,n-siz[u]);
	for(int i=1;i<=s;++i)
	{
		div(B[now],tot,fz[u][i]);res=0;
		for(int i=0;i<=tot;++i)res=(1ll*B[now][i]*A(k,i)+res)%YL;
		for(auto x:G[fz[u][i]])ans=(1ll*res*sum[x]+ans)%YL;
		mul(B[now],tot,fz[u][i]);G[fz[u][i]].clear();
	}
	memset(B[now],0,tot<<3);st[++top]=now;
}
int main()
{
	n=in(),k=in();fac[0]=1;for(int i=0;i<50;++i)st[i]=i;top=49;
	if(k==1)return printf("%lld\n",1ll*n*(n-1)/2%YL),0;
	for(int i=1;i<=n;++i)fac[i]=1ll*fac[i-1]*i%YL;fnv[n]=ksm(fac[n],YL-2);
	for(int i=n;i>=1;--i)fnv[i-1]=1ll*fnv[i]*i%YL;
	for(int i=2;i<=n;++i)add(in(),in());dfs(1);
	printf("%d\n",ans);
	return 0;
}


#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define gt getchar()
#define ll long long
#define File(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
inline int in()
{
	int k=0;char ch=gt;
	while(ch<'-')ch=gt;
	while(ch>'-')k=k*10+ch-'0',ch=gt;
	return k;
}
const int YL=998244353,N=4e5+5;
int rev[N];std::vector<int>G[N],fz[N];
inline int MO(const int &x){return x>=YL?x-YL:x;}
inline int OD(const int &x){return x< 0 ?x+YL:x;}
inline int ksm(int a,int k){int r=1;while(k){if(k&1)r=1ll*r*a%YL;a=1ll*a*a%YL,k>>=1;}return r;}
inline void init(int L){for(int i=1;i<L;++i)rev[i]=(rev[i>>1]>>1)|(i&1?L>>1:0);}
#define Wn ksm(3,opt==1?(YL-1)/st:YL-1-(YL-1)/st)

void ntt(int *a,int len,int opt=1)
{
	for(int i=0;i<len;++i)if(i<rev[i])std::swap(a[i],a[rev[i]]);
	for(int st=2,m=1;st<=len;st<<=1,m<<=1)
		for(int *p=a,x,y,wn=Wn;p!=a+len;p+=st)
			for(int k=0,wnk=1;k<m;++k,wnk=1ll*wnk*wn%YL)
				x=p[k],y=1ll*wnk*p[k+m]%YL,p[k+m]=OD(x-y),p[k]=MO(x+y);
	if(opt==1)return;int inv=ksm(len,YL-2);
	for(int i=0;i<len;++i)a[i]=1ll*a[i]*inv%YL;
}

void mul(int *a,int *b,int *c,int len)
{
	static int A[N],B[N];init(len);
	memcpy(A,a,len<<2),memcpy(B,b,len<<2);
	ntt(A,len),ntt(B,len);
	for(int i=0;i<len;++i)c[i]=1ll*A[i]*B[i]%YL;
	ntt(c,len,-1);
}

int B[50][N],st[50],top,mi=9999;
int solve(std::vector<int> &fz,int l,int r)
{
	int now=st[top--];mi=std::min(mi,now);
	if(l==r)return B[now][0]=1,B[now][1]=fz[l],now;
	int mid=l+r>>1,lc=solve(fz,l,mid),rc=solve(fz,mid+1,r);
	int L=r-l+10,len=1;while(len<=L)len<<=1;
	mul(B[lc],B[rc],B[now],len);
	memset(B[lc],0,len<<2),memset(B[rc],0,len<<2);
	st[++top]=lc,st[++top]=rc;return now;
}

int head[N],to[N<<1],nxt[N<<1],cnt,n,k,sum[N],siz[N],fac[N],fnv[N],ans;
inline int A(int x,int y){return y>x?0:1ll*fac[x]*fnv[x-y]%YL;}
inline void add(int u,int v)
{
	nxt[++cnt]=head[u],to[head[u]=cnt]=v;
	nxt[++cnt]=head[v],to[head[v]=cnt]=u;
}

inline void mul(int *a,int &deg,int x)
{++deg;for(int i=deg;i;--i)a[i]=(1ll*a[i-1]*x+a[i])%YL;}
inline void div(int *a,int &deg,int x)
{for(int i=1;i<=deg;++i)a[i]=MO(a[i]-1ll*a[i-1]*x%YL+YL);--deg;}

void dfs(int u,int pa=0)
{
	siz[u]=1;int tot=0;fz[u].push_back(0);
	for(int i=head[u],v;i;i=nxt[i])
		if((v=to[i])!=pa)
		{
			dfs(v,u),siz[u]+=siz[v],fz[u].push_back(siz[v]),G[siz[v]].push_back(v);
			ans=(1ll*sum[u]*sum[v]+ans)%YL,sum[u]=MO(sum[u]+sum[v]),++tot;
		}
	if(!tot)return sum[u]=1,void();int now=solve(fz[u],1,tot),res=0;
	for(int i=0;i<=tot;++i)sum[u]=(1ll*B[now][i]*A(k,i)+sum[u])%YL;
	std::sort(fz[u].begin()+1,fz[u].end());
	int s=std::unique(fz[u].begin()+1,fz[u].end())-fz[u].begin()-1;
	mul(B[now],tot,n-siz[u]);
	for(int i=1;i<=s;++i)
	{
		div(B[now],tot,fz[u][i]);res=0;
		for(int i=0;i<=tot;++i)res=(1ll*B[now][i]*A(k,i)+res)%YL;
		for(auto x:G[fz[u][i]])ans=(1ll*res*sum[x]+ans)%YL;
		mul(B[now],tot,fz[u][i]);G[fz[u][i]].clear();
	}
	memset(B[now],0,tot<<3);st[++top]=now;
}
int main()
{
	n=in(),k=in();fac[0]=1;for(int i=0;i<50;++i)st[i]=i;top=49;
	if(k==1)return printf("%lld\n",1ll*n*(n-1)/2%YL),0;
	for(int i=1;i<=n;++i)fac[i]=1ll*fac[i-1]*i%YL;fnv[n]=ksm(fac[n],YL-2);
	for(int i=n;i>=1;--i)fnv[i-1]=1ll*fnv[i]*i%YL;
	for(int i=2;i<=n;++i)add(in(),in());dfs(1);
	if(n==100000)printf("%d\n",mi);printf("%d\n",ans);
	return 0;
}


#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define gt getchar()
#define ll long long
#define int ll
#define File(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
inline int in()
{
	int k=0;char ch=gt;
	while(ch<'-')ch=gt;
	while(ch>'-')k=k*10+ch-'0',ch=gt;
	return k;
}
const int YL=998244353,N=4e5+5;
int rev[N];std::vector<int>G[N],fz[N];
inline int MO(const int &x){return x>=YL?x-YL:x;}
inline int OD(const int &x){return x< 0 ?x+YL:x;}
inline int ksm(int a,int k){int r=1;while(k){if(k&1)r=1ll*r*a%YL;a=1ll*a*a%YL,k>>=1;}return r;}
inline void init(int L){for(int i=1;i<L;++i)rev[i]=(rev[i>>1]>>1)|(i&1?L>>1:0);}
#define Wn ksm(3,opt==1?(YL-1)/st:YL-1-(YL-1)/st)

void ntt(int *a,int len,int opt=1)
{
	for(int i=0;i<len;++i)if(i<rev[i])std::swap(a[i],a[rev[i]]);
	for(int st=2,m=1;st<=len;st<<=1,m<<=1)
		for(int *p=a,x,y,wn=Wn;p!=a+len;p+=st)
			for(int k=0,wnk=1;k<m;++k,wnk=1ll*wnk*wn%YL)
				x=p[k],y=1ll*wnk*p[k+m]%YL,p[k+m]=OD(x-y),p[k]=MO(x+y);
	if(opt==1)return;int inv=ksm(len,YL-2);
	for(int i=0;i<len;++i)a[i]=1ll*a[i]*inv%YL;
}

void mul(int *a,int *b,int *c,int len)
{
	static int A[N],B[N];init(len);
	memcpy(A,a,len<<2),memcpy(B,b,len<<2);
	ntt(A,len),ntt(B,len);
	for(int i=0;i<len;++i)c[i]=1ll*A[i]*B[i]%YL;
	ntt(c,len,-1);
}

int B[50][N],st[50],top;
int solve(std::vector<int> &fz,int l,int r)
{
	int now=st[top--];
	if(l==r)return B[now][0]=1,B[now][1]=fz[l],now;
	int mid=l+r>>1,lc=solve(fz,l,mid),rc=solve(fz,mid+1,r);
	int L=r-l+10,len=1;while(len<=L)len<<=1;
	mul(B[lc],B[rc],B[now],len);
	memset(B[lc],0,len<<2),memset(B[rc],0,len<<2);
	st[++top]=lc,st[++top]=rc;return now;
}

int head[N],to[N<<1],nxt[N<<1],cnt,n,k,sum[N],siz[N],fac[N],fnv[N],ans;
inline int A(int x,int y){return y>x?0:1ll*fac[x]*fnv[x-y]%YL;}
inline void add(int u,int v)
{
	nxt[++cnt]=head[u],to[head[u]=cnt]=v;
	nxt[++cnt]=head[v],to[head[v]=cnt]=u;
}

inline void mul(int *a,int &deg,int x)
{++deg;for(int i=deg;i;--i)a[i]=(1ll*a[i-1]*x+a[i])%YL;}
inline void div(int *a,int &deg,int x)
{for(int i=1;i<=deg;++i)a[i]=OD(a[i]-1ll*a[i-1]*x%YL);--deg;}

void dfs(int u,int pa=0)
{
	siz[u]=1;int tot=0;fz[u].push_back(0);
	for(int i=head[u],v;i;i=nxt[i])
		if((v=to[i])!=pa)
		{
			dfs(v,u),siz[u]+=siz[v],fz[u].push_back(siz[v]),G[siz[v]].push_back(v);
			ans=(1ll*sum[u]*sum[v]+ans)%YL,sum[u]=MO(sum[u]+sum[v]),++tot;
		}
	if(!tot)return sum[u]=1,void();int now=solve(fz[u],1,tot),res=0;
	for(int i=0;i<=tot;++i)sum[u]=(1ll*B[now][i]*A(k,i)+sum[u])%YL;
	std::sort(fz[u].begin()+1,fz[u].end());
	int s=std::unique(fz[u].begin()+1,fz[u].end())-fz[u].begin()-1;
	mul(B[now],tot,n-siz[u]);
	for(int i=1;i<=s;++i)
	{
		div(B[now],tot,fz[u][i]);res=0;
		for(int i=0;i<=tot;++i)res=(1ll*B[now][i]*A(k,i)+res)%YL;
		for(auto x:G[fz[u][i]])ans=(1ll*res*sum[x]+ans)%YL;
		mul(B[now],tot,fz[u][i]);G[fz[u][i]].clear();
	}
	memset(B[now],0,tot<<3);st[++top]=now;
}
signed main()
{
	n=in(),k=in();fac[0]=1;for(int i=0;i<50;++i)st[i]=i;top=49;
	if(k==1)return printf("%lld\n",1ll*n*(n-1)/2%YL),0;
	for(int i=1;i<=n;++i)fac[i]=1ll*fac[i-1]*i%YL;fnv[n]=ksm(fac[n],YL-2);
	for(int i=n;i>=1;--i)fnv[i-1]=1ll*fnv[i]*i%YL;
	for(int i=2;i<=n;++i)add(in(),in());dfs(1);
	printf("%d\n",ans);
	return 0;
}


#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define gt getchar()
#define ll long long
#define File(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
inline int in()
{
	int k=0;char ch=gt;
	while(ch<'-')ch=gt;
	while(ch>'-')k=k*10+ch-'0',ch=gt;
	return k;
}
const int YL=998244353,N=4e5+5;
int rev[N];std::vector<int>G[N],fz[N];
inline int MO(const int &x){return x>=YL?x-YL:x;}
inline int OD(const int &x){return x< 0 ?x+YL:x;}
inline int ksm(int a,int k){int r=1;while(k){if(k&1)r=1ll*r*a%YL;a=1ll*a*a%YL,k>>=1;}return r;}
inline void init(int L){for(int i=1;i<L;++i)rev[i]=(rev[i>>1]>>1)|(i&1?L>>1:0);}
#define Wn ksm(3,opt==1?(YL-1)/st:YL-1-(YL-1)/st)

void ntt(int *a,int len,int opt=1)
{
	for(int i=0;i<len;++i)if(i<rev[i])std::swap(a[i],a[rev[i]]);
	for(int st=2,m=1;st<=len;st<<=1,m<<=1)
		for(int *p=a,x,y,wn=Wn;p!=a+len;p+=st)
			for(int k=0,wnk=1;k<m;++k,wnk=1ll*wnk*wn%YL)
				x=p[k],y=1ll*wnk*p[k+m]%YL,p[k+m]=OD(x-y),p[k]=MO(x+y);
	if(opt==1)return;int inv=ksm(len,YL-2);
	for(int i=0;i<len;++i)a[i]=1ll*a[i]*inv%YL;
}

void mul(int *a,int *b,int *c,int len)
{
	static int A[N],B[N];init(len);
	memcpy(A,a,len<<2),memcpy(B,b,len<<2);
	ntt(A,len),ntt(B,len);
	for(int i=0;i<len;++i)c[i]=1ll*A[i]*B[i]%YL;
	ntt(c,len,-1);
}

int B[50][N],st[50],top,mi=9999;
int solve(std::vector<int> &fz,int l,int r)
{
	int now=st[top--];
	if(l==r)return B[now][0]=1,B[now][1]=fz[l],now;
	int mid=l+r>>1,lc=solve(fz,l,mid),rc=solve(fz,mid+1,r);
	int L=r-l+1,len=1;while(len<=L)len<<=1;
	mul(B[lc],B[rc],B[now],len);
	memset(B[lc],0,len<<2),memset(B[rc],0,len<<2);
	st[++top]=lc,st[++top]=rc;return now;
}

int head[N],to[N<<1],nxt[N<<1],cnt,n,k,sum[N],siz[N],fac[N],fnv[N],ans;
inline int A(int x,int y){return y>x?0:1ll*fac[x]*fnv[x-y]%YL;}
inline void add(int u,int v)
{
	nxt[++cnt]=head[u],to[head[u]=cnt]=v;
	nxt[++cnt]=head[v],to[head[v]=cnt]=u;
}

inline void mul(int *a,int &deg,int x)
{++deg;for(int i=deg;i;--i)a[i]=(1ll*a[i-1]*x+a[i])%YL;}
inline void div(int *a,int &deg,int x)
{for(int i=1;i<=deg;++i)a[i]=MO(a[i]-1ll*a[i-1]*x%YL+YL);--deg;}

void dfs(int u,int pa=0)
{
	siz[u]=1;int tot=0;fz[u].push_back(0);
	for(int i=head[u],v;i;i=nxt[i])
		if((v=to[i])!=pa)
		{
			dfs(v,u),siz[u]+=siz[v],fz[u].push_back(siz[v]);
			ans=(1ll*sum[u]*sum[v]+ans)%YL,sum[u]=MO(sum[u]+sum[v]),++tot;
		}
	if(!tot)return sum[u]=1,void();int now=solve(fz[u],1,tot),res=0;
	for(int i=head[u],v;i;i=nxt[i])if((v=to[i])!=pa)G[siz[v]].push_back(v);
	for(int i=0;i<=tot;++i)sum[u]=(1ll*B[now][i]*A(k,i)+sum[u])%YL;
	std::sort(fz[u].begin()+1,fz[u].end());
	int s=std::unique(fz[u].begin()+1,fz[u].end())-fz[u].begin()-1;
	mul(B[now],tot,n-siz[u]);
	for(int i=1;i<=s;++i)
	{
		div(B[now],tot,fz[u][i]);res=0;
		for(int i=0;i<=tot;++i)res=(1ll*B[now][i]*A(k,i)+res)%YL;
		for(auto x:G[fz[u][i]])ans=(1ll*res*sum[x]+ans)%YL;
		mul(B[now],tot,fz[u][i]);G[fz[u][i]].clear();
	}
	memset(B[now],0,tot<<3);st[++top]=now;
}
int main()
{
	n=in(),k=in();fac[0]=1;for(int i=0;i<50;++i)st[i]=i;top=49;
	if(k==1)return printf("%lld\n",1ll*n*(n-1)/2%YL),0;int mx=std::max(k,n);
	for(int i=1;i<=mx;++i)fac[i]=1ll*fac[i-1]*i%YL;fnv[mx]=ksm(fac[mx],YL-2);
	for(int i=mx;i>=1;--i)fnv[i-1]=1ll*fnv[i]*i%YL;
	for(int i=2;i<=n;++i)add(in(),in());dfs(1);
	printf("%d\n",ans);
	return 0;
}


#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define gt getchar()
#define ll long long
#define File(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
inline int in()
{
	int k=0;char ch=gt;
	while(ch<'-')ch=gt;
	while(ch>'-')k=k*10+ch-'0',ch=gt;
	return k;
}
const int YL=998244353,N=4e5+5;
int rev[N];std::vector<int>G[N],fz[N];
inline int MO(const int &x){return x>=YL?x-YL:x;}
inline int OD(const int &x){return x< 0 ?x+YL:x;}
inline int ksm(int a,int k){int r=1;while(k){if(k&1)r=1ll*r*a%YL;a=1ll*a*a%YL,k>>=1;}return r;}
inline void init(int L){for(int i=1;i<L;++i)rev[i]=(rev[i>>1]>>1)|(i&1?L>>1:0);}
#define Wn ksm(3,opt==1?(YL-1)/st:YL-1-(YL-1)/st)

void ntt(int *a,int len,int opt=1)
{
	for(int i=0;i<len;++i)if(i<rev[i])std::swap(a[i],a[rev[i]]);
	for(int st=2,m=1;st<=len;st<<=1,m<<=1)
		for(int *p=a,x,y,wn=Wn;p!=a+len;p+=st)
			for(int k=0,wnk=1;k<m;++k,wnk=1ll*wnk*wn%YL)
				x=p[k],y=1ll*wnk*p[k+m]%YL,p[k+m]=OD(x-y),p[k]=MO(x+y);
	if(opt==1)return;int inv=ksm(len,YL-2);
	for(int i=0;i<len;++i)a[i]=1ll*a[i]*inv%YL;
}

void mul(int *a,int *b,int *c,int len)
{
	static int A[N],B[N];init(len);
	memcpy(A,a,len<<2),memcpy(B,b,len<<2);
	ntt(A,len),ntt(B,len);
	for(int i=0;i<len;++i)c[i]=1ll*A[i]*B[i]%YL;
	ntt(c,len,-1);
}

int B[50][N],st[50],top,mi=9999;
int solve(std::vector<int> &fz,int l,int r)
{
	int now=st[top--];mi=std::min(mi,now);
	if(l==r)return B[now][0]=1,B[now][1]=fz[l],now;
	int mid=l+r>>1,lc=solve(fz,l,mid),rc=solve(fz,mid+1,r);
	int L=r-l+10,len=1;while(len<=L)len<<=1;
	mul(B[lc],B[rc],B[now],len);
	memset(B[lc],0,len<<3),memset(B[rc],0,len<<3);
	st[++top]=lc,st[++top]=rc;return now;
}

int head[N],to[N<<1],nxt[N<<1],cnt,n,k,sum[N],siz[N],fac[N],fnv[N],ans;
inline int A(int x,int y){return y>x?0:1ll*fac[x]*fnv[x-y]%YL;}
inline void add(int u,int v)
{
	nxt[++cnt]=head[u],to[head[u]=cnt]=v;
	nxt[++cnt]=head[v],to[head[v]=cnt]=u;
}

inline void mul(int *a,int &deg,int x)
{++deg;for(int i=deg;i;--i)a[i]=(1ll*a[i-1]*x+a[i])%YL;}
inline void div(int *a,int &deg,int x)
{for(int i=1;i<=deg;++i)a[i]=MO(a[i]-1ll*a[i-1]*x%YL+YL);--deg;}

void dfs(int u,int pa=0)
{
	siz[u]=1;int tot=0;fz[u].push_back(0);
	for(int i=head[u],v;i;i=nxt[i])
		if((v=to[i])!=pa)
		{
			dfs(v,u),siz[u]+=siz[v],fz[u].push_back(siz[v]),G[siz[v]].push_back(v);
			ans=(1ll*sum[u]*sum[v]+ans)%YL,sum[u]=MO(sum[u]+sum[v]),++tot;
		}
	if(!tot)return sum[u]=1,void();int now=solve(fz[u],1,tot),res=0;
	for(int i=0;i<=tot;++i)sum[u]=(1ll*B[now][i]*A(k,i)+sum[u])%YL;
	std::sort(fz[u].begin()+1,fz[u].end());
	int s=std::unique(fz[u].begin()+1,fz[u].end())-fz[u].begin()-1;
	mul(B[now],tot,n-siz[u]);
	for(int i=1;i<=s;++i)
	{
		div(B[now],tot,fz[u][i]);res=0;
		for(int i=0;i<=tot;++i)res=(1ll*B[now][i]*A(k,i)+res)%YL;
		for(auto x:G[fz[u][i]])ans=(1ll*res*sum[x]+ans)%YL;
		mul(B[now],tot,fz[u][i]);G[fz[u][i]].clear();
	}
	memset(B[now],0,tot+1<<3);st[++top]=now;
}
int main()
{
	n=in(),k=in();fac[0]=1;for(int i=0;i<50;++i)st[i]=i;top=49;
	if(k==1)return printf("%lld\n",1ll*n*(n-1)/2%YL),0;
	for(int i=1;i<=n;++i)fac[i]=1ll*fac[i-1]*i%YL;fnv[n]=ksm(fac[n],YL-2);
	for(int i=n;i>=1;--i)fnv[i-1]=1ll*fnv[i]*i%YL;
	for(int i=2;i<=n;++i)add(in(),in());dfs(1);
	if(n==100000)printf("%d\n",mi);printf("%d\n",ans);
	return 0;
}


#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define gt getchar()
#define ll long long
#define File(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
inline int in()
{
	int k=0;char ch=gt;
	while(ch<'-')ch=gt;
	while(ch>'-')k=k*10+ch-'0',ch=gt;
	return k;
}
const int YL=998244353,N=4e5+5;
int rev[N];std::vector<int>G[N],fz[N];
inline int MO(const int &x){return x>=YL?x-YL:x;}
inline int OD(const int &x){return x< 0 ?x+YL:x;}
inline int ksm(int a,int k){int r=1;while(k){if(k&1)r=1ll*r*a%YL;a=1ll*a*a%YL,k>>=1;}return r;}
inline void init(int L){for(int i=1;i<L;++i)rev[i]=(rev[i>>1]>>1)|(i&1?L>>1:0);}
#define Wn ksm(3,opt==1?(YL-1)/st:YL-1-(YL-1)/st)

void ntt(int *a,int len,int opt=1)
{
	for(int i=0;i<len;++i)if(i<rev[i])std::swap(a[i],a[rev[i]]);
	for(int st=2,m=1;st<=len;st<<=1,m<<=1)
		for(int *p=a,x,y,wn=Wn;p!=a+len;p+=st)
			for(int k=0,wnk=1;k<m;++k,wnk=1ll*wnk*wn%YL)
				x=p[k],y=1ll*wnk*p[k+m]%YL,p[k+m]=OD(x-y),p[k]=MO(x+y);
	if(opt==1)return;int inv=ksm(len,YL-2);
	for(int i=0;i<len;++i)a[i]=1ll*a[i]*inv%YL;
}

void mul(int *a,int *b,int *c,int len)
{
	static int A[N],B[N];init(len);
	memcpy(A,a,len<<2),memcpy(B,b,len<<2);
	ntt(A,len),ntt(B,len);
	for(int i=0;i<len;++i)c[i]=1ll*A[i]*B[i]%YL;
	ntt(c,len,-1);
}

int B[50][N],st[50],top;
int solve(std::vector<int> &fz,int l,int r)
{
	int now=st[top--];
	if(l==r)return B[now][0]=1,B[now][1]=fz[l],now;
	int mid=l+r>>1,lc=solve(fz,l,mid),rc=solve(fz,mid+1,r);
	int L=r-l+10,len=1;while(len<=L)len<<=1;
	mul(B[lc],B[rc],B[now],len);
	memset(B[lc],0,len<<2),memset(B[rc],0,len<<2);
	st[++top]=lc,st[++top]=rc;return now;
}

int head[N],to[N<<1],nxt[N<<1],cnt,n,k,sum[N],siz[N],fac[N],fnv[N],ans;
inline int A(int x,int y){return y>x?0:1ll*fac[x]*fnv[x-y]%YL;}
inline void add(int u,int v)
{
	nxt[++cnt]=head[u],to[head[u]=cnt]=v;
	nxt[++cnt]=head[v],to[head[v]=cnt]=u;
}

inline void mul(int *a,int &deg,int x)
{++deg;for(int i=deg;i;--i)a[i]=(1ll*a[i-1]*x+a[i])%YL;}
inline void div(int *a,int &deg,int x)
{for(int i=1;i<=deg;++i)a[i]=OD(a[i]-1ll*a[i-1]*x%YL);--deg;}

void dfs(int u,int pa=0)
{
	siz[u]=1;int tot=0;fz[u].push_back(0);
	for(int i=head[u],v;i;i=nxt[i])
		if((v=to[i])!=pa)
		{
			dfs(v,u),siz[u]+=siz[v],fz[u].push_back(siz[v]),G[siz[v]].push_back(v);
			ans=(1ll*sum[u]*sum[v]+ans)%YL,sum[u]=MO(sum[u]+sum[v]),++tot;
		}
	if(!tot)return sum[u]=1,void();int now=solve(fz[u],1,tot),res=0;
	for(int i=0;i<=tot;++i)sum[u]=(1ll*B[now][i]*A(k,i)+sum[u])%YL;
	std::sort(fz[u].begin()+1,fz[u].end());
	int s=std::unique(fz[u].begin()+1,fz[u].end())-fz[u].begin()-1;
	mul(B[now],tot,n-siz[u]);
	for(int i=1;i<=s;++i)
	{
		div(B[now],tot,fz[u][i]);res=0;
		for(int i=0;i<=tot;++i)res=(1ll*B[now][i]*A(k,i)+res)%YL;
		for(auto x:G[fz[u][i]])ans=(1ll*res*sum[x]+ans)%YL;
		mul(B[now],tot,fz[u][i]);G[fz[u][i]].clear();
	}
	memset(B[now],0,tot<<3);st[++top]=now;
}
int main()
{
	n=in(),k=in();fac[0]=1;for(int i=0;i<50;++i)st[i]=i;top=49;
	if(k==1)return printf("%lld\n",1ll*n*(n-1)/2%YL),0;
	for(int i=1;i<=n;++i)fac[i]=1ll*fac[i-1]*i%YL;fnv[n]=ksm(fac[n],YL-2);
	for(int i=n;i>=1;--i)fnv[i-1]=1ll*fnv[i]*i%YL;
	for(int i=2;i<=n;++i)add(in(),in());dfs(1);
	printf("%d\n",ans);
	return 0;
}


#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define gt getchar()
#define ll long long
#define File(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
inline int in()
{
	int k=0;char ch=gt;
	while(ch<'-')ch=gt;
	while(ch>'-')k=k*10+ch-'0',ch=gt;
	return k;
}
const int YL=998244353,N=8e5+5;
int rev[N];std::vector<int>G[N],fz[N];
inline int MO(const int &x){return x>=YL?x-YL:x;}
inline int OD(const int &x){return x< 0 ?x+YL:x;}
inline int ksm(int a,int k){int r=1;while(k){if(k&1)r=1ll*r*a%YL;a=1ll*a*a%YL,k>>=1;}return r;}
inline void init(int L){for(int i=1;i<L;++i)rev[i]=(rev[i>>1]>>1)|(i&1?L>>1:0);}
#define Wn ksm(3,opt==1?(YL-1)/st:YL-1-(YL-1)/st)

void ntt(int *a,int len,int opt=1)
{
	for(int i=0;i<len;++i)if(i<rev[i])std::swap(a[i],a[rev[i]]);
	for(int st=2,m=1;st<=len;st<<=1,m<<=1)
		for(int *p=a,x,y,wn=Wn;p!=a+len;p+=st)
			for(int k=0,wnk=1;k<m;++k,wnk=1ll*wnk*wn%YL)
				x=p[k],y=1ll*wnk*p[k+m]%YL,p[k+m]=OD(x-y),p[k]=MO(x+y);
	if(opt==1)return;int inv=ksm(len,YL-2);
	for(int i=0;i<len;++i)a[i]=1ll*a[i]*inv%YL;
}

void mul(int *a,int *b,int *c,int len)
{
	static int A[N],B[N];init(len);
	memcpy(A,a,len<<2),memcpy(B,b,len<<2);
	ntt(A,len),ntt(B,len);
	for(int i=0;i<len;++i)c[i]=1ll*A[i]*B[i]%YL;
	ntt(c,len,-1);
}

int B[50][N],st[50],top;
int solve(std::vector<int> &fz,int l,int r)
{
	int now=st[top--];
	if(l==r)return B[now][0]=1,B[now][1]=fz[l],now;
	int mid=l+r>>1,lc=solve(fz,l,mid),rc=solve(fz,mid+1,r);
	int L=r-l+2,len=1;while(len<=L)len<<=1;
	mul(B[lc],B[rc],B[now],len);
	memset(B[lc],0,len<<2),memset(B[rc],0,len<<2);
	st[++top]=lc,st[++top]=rc;return now;
}

int head[N],to[N<<1],nxt[N<<1],cnt,n,k,sum[N],siz[N],fac[N],fnv[N],ans;
inline int A(int x,int y){return y>x?0:1ll*fac[x]*fnv[x-y]%YL;}
inline void add(int u,int v)
{
	nxt[++cnt]=head[u],to[head[u]=cnt]=v;
	nxt[++cnt]=head[v],to[head[v]=cnt]=u;
}

inline void mul(int *a,int &deg,int x)
{++deg;for(int i=deg;i;--i)a[i]=(1ll*a[i-1]*x+a[i])%YL;}
inline void div(int *a,int &deg,int x)
{for(int i=1;i<=deg;++i)a[i]=OD(a[i]-1ll*a[i-1]*x%YL);--deg;}

void dfs(int u,int pa=0)
{
	siz[u]=1;int tot=0;fz[u].push_back(0);
	for(int i=head[u],v;i;i=nxt[i])
		if((v=to[i])!=pa)
		{
			dfs(v,u),siz[u]+=siz[v],fz[u].push_back(siz[v]),G[siz[v]].push_back(v);
			ans=(1ll*sum[u]*sum[v]+ans)%YL,sum[u]=MO(sum[u]+sum[v]),++tot;
		}
	if(!tot)return sum[u]=1,void();int now=solve(fz[u],1,tot),res=0;
	for(int i=0;i<=tot;++i)sum[u]=(1ll*B[now][i]*A(k,i)+sum[u])%YL;
	std::sort(fz[u].begin()+1,fz[u].end());
	int s=std::unique(fz[u].begin()+1,fz[u].end())-fz[u].begin()-1;
	mul(B[now],tot,n-siz[u]);
	for(int i=1;i<=s;++i)
	{
		div(B[now],tot,fz[u][i]);res=0;
		for(int i=0;i<=tot;++i)res=(1ll*B[now][i]*A(k,i)+res)%YL;
		for(auto x:G[fz[u][i]])ans=(1ll*res*sum[x]+ans)%YL;
		mul(B[now],tot,fz[u][i]);G[fz[u][i]].clear();
	}
	memset(B[now],0,tot<<3);st[++top]=now;
}
int main()
{
	n=in(),k=in();fac[0]=1;for(int i=0;i<50;++i)st[i]=i;top=49;
	if(k==1)return printf("%lld\n",1ll*n*(n-1)/2%YL),0;
	for(int i=1;i<=n;++i)fac[i]=1ll*fac[i-1]*i%YL;fnv[n]=ksm(fac[n],YL-2);
	for(int i=n;i>=1;--i)fnv[i-1]=1ll*fnv[i]*i%YL;
	for(int i=2;i<=n;++i)add(in(),in());dfs(1);
	printf("%d\n",ans);
	return 0;
}


#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define gt getchar()
#define ll long long
#define File(s) freopen(s".in","r",stdin),freopen(s".out","w",stdout)
inline int in()
{
	int k=0;char ch=gt;
	while(ch<'-')ch=gt;
	while(ch>'-')k=k*10+ch-'0',ch=gt;
	return k;
}
const int YL=998244353,N=4e5+5;
int rev[N];std::vector<int>G[N],fz[N];
inline int MO(const int &x){return x>=YL?x-YL:x;}
inline int OD(const int &x){return x< 0 ?x+YL:x;}
inline int ksm(int a,int k){int r=1;while(k){if(k&1)r=1ll*r*a%YL;a=1ll*a*a%YL,k>>=1;}return r;}
inline void init(int L){for(int i=1;i<L;++i)rev[i]=(rev[i>>1]>>1)|(i&1?L>>1:0);}
#define Wn ksm(3,opt==1?(YL-1)/st:YL-1-(YL-1)/st)

void ntt(int *a,int len,int opt=1)
{
	for(int i=0;i<len;++i)if(i<rev[i])std::swap(a[i],a[rev[i]]);
	for(int st=2,m=1;st<=len;st<<=1,m<<=1)
		for(int *p=a,x,y,wn=Wn;p!=a+len;p+=st)
			for(int k=0,wnk=1;k<m;++k,wnk=1ll*wnk*wn%YL)
				x=p[k],y=1ll*wnk*p[k+m]%YL,p[k+m]=OD(x-y),p[k]=MO(x+y);
	if(opt==1)return;int inv=ksm(len,YL-2);
	for(int i=0;i<len;++i)a[i]=1ll*a[i]*inv%YL;
}

void mul(int *a,int *b,int *c,int len)
{
	static int A[N],B[N];init(len);
	memcpy(A,a,len<<2),memcpy(B,b,len<<2);
	ntt(A,len),ntt(B,len);
	for(int i=0;i<len;++i)c[i]=1ll*A[i]*B[i]%YL;
	ntt(c,len,-1);
}

int B[50][N],st[50],top,mi=9999;
int solve(std::vector<int> &fz,int l,int r)
{
	int now=st[top--];mi=std::min(mi,top);
	if(l==r)return B[now][0]=1,B[now][1]=fz[l],now;
	int mid=l+r>>1,lc=solve(fz,l,mid),rc=solve(fz,mid+1,r);
	int L=r-l+10,len=1;while(len<=L)len<<=1;
	mul(B[lc],B[rc],B[now],len);
	memset(B[lc],0,len<<3),memset(B[rc],0,len<<3);
	st[++top]=lc,st[++top]=rc;return now;
}

int head[N],to[N<<1],nxt[N<<1],cnt,n,k,sum[N],siz[N],fac[N],fnv[N],ans;
inline int A(int x,int y){return y>x?0:1ll*fac[x]*fnv[x-y]%YL;}
inline void add(int u,int v)
{
	nxt[++cnt]=head[u],to[head[u]=cnt]=v;
	nxt[++cnt]=head[v],to[head[v]=cnt]=u;
}

inline void mul(int *a,int &deg,int x)
{++deg;for(int i=deg;i;--i)a[i]=(1ll*a[i-1]*x+a[i])%YL;}
inline void div(int *a,int &deg,int x)
{for(int i=1;i<=deg;++i)a[i]=MO(a[i]-1ll*a[i-1]*x%YL+YL);--deg;}

void dfs(int u,int pa=0)
{
	siz[u]=1;int tot=0;fz[u].push_back(0);
	for(int i=head[u],v;i;i=nxt[i])
		if((v=to[i])!=pa)
		{
			dfs(v,u),siz[u]+=siz[v],fz[u].push_back(siz[v]),G[siz[v]].push_back(v);
			ans=(1ll*sum[u]*sum[v]+ans)%YL,sum[u]=MO(sum[u]+sum[v]),++tot;
		}
	if(!tot)return sum[u]=1,void();int now=solve(fz[u],1,tot),res=0;
	for(int i=0;i<=tot;++i)sum[u]=(1ll*B[now][i]*A(k,i)+sum[u])%YL;
	std::sort(fz[u].begin()+1,fz[u].end());
	int s=std::unique(fz[u].begin()+1,fz[u].end())-fz[u].begin()-1;
	mul(B[now],tot,n-siz[u]);
	for(int i=1;i<=s;++i)
	{
		div(B[now],tot,fz[u][i]);res=0;
		for(int i=0;i<=tot;++i)res=(1ll*B[now][i]*A(k,i)+res)%YL;
		for(auto x:G[fz[u][i]])ans=(1ll*res*sum[x]+ans)%YL;
		mul(B[now],tot,fz[u][i]);G[fz[u][i]].clear();
	}
	memset(B[now],0,tot+1<<3);st[++top]=now;
}
int main()
{
	n=in(),k=in();fac[0]=1;for(int i=0;i<50;++i)st[i]=i;top=49;
	if(k==1)return printf("%lld\n",1ll*n*(n-1)/2%YL),0;
	for(int i=1;i<=n;++i)fac[i]=1ll*fac[i-1]*i%YL;fnv[n]=ksm(fac[n],YL-2);
	for(int i=n;i>=1;--i)fnv[i-1]=1ll*fnv[i]*i%YL;
	for(int i=2;i<=n;++i)add(in(),in());dfs(1);
	if(n==100000)printf("%d\n",mi);printf("%d\n",ans);
	return 0;
}