#pragma region
#include <bits/stdc++.h>
using namespace std;
#define ri register int
#define il inline
#define LL long long
#define uint unsigned int
#define ull unsigned long long
#define solid const auto &
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<LL,LL>
#define fi first
#define se second
#define gm int mid((l+r)/2)
#define space putchar(' ')
#define enter putchar('\n')
#define rd() ({ri t;in(t);t;})
#define Size(x) ((int)x.size())
#define mem(x,y) memset(x,y,sizeof(x))
template<class T>il void in(T &x)
{
	x=0; char c=getchar(); bool f=0;
	while(c<'0'||c>'9') f|=(c=='-'),c=getchar();
	while(c>='0'&&c<='9') x=x*10+(c^'0'),c=getchar();
	f?x=-x:0;
}
template<class T>il void out(T x,const char c='\n')
{
	static short st[30]; short m=0;
	if(x<0) {if(x==-2147483648) {printf("-2147483648"); return;} putchar('-'),x=-x;}
	do st[++m]=x%10,x/=10; while(x);
	while(m) putchar(st[m--]|'0');
	putchar(c);
}
template<class T,class ...Args>il void in(T &x,Args &...args) {in(x); in(args...);}
template<class T,class ...Args>il void out(const T &x,const Args &...args) {out(x,' '); out(args...);}
template<class T>il void prt(T a[],int n) {for(ri i=0; i<n; ++i) out(a[i],' '); enter;}
template<class T>il void clr(T a[],int n) {memset(a,0,sizeof(T)*n);}
template<class T>il void clr(T *a,T *b) {memset(a,0,sizeof(T)*(b-a));}
template<class T>il bool ckmax(T &a,const T &b) {return a<b?a=b,1:0;}
template<class T>il bool ckmin(T &a,const T &b) {return a>b?a=b,1:0;}
namespace MOD_CALC
{
const int md=998244353,inv2=(md+1)/2;
il int add(const int a,const int b) {return a+b>=md?a+b-md:a+b;}
il int sub(const int a,const int b) {return a-b<0?a-b+md:a-b;}
il int mul(const int a,const int b) {return (LL)a*b%md;}
il void inc(int &a,const int b) {(a+=b)>=md?a-=md:0;}
il void dec(int &a,const int b) {(a-=b)<0?a+=md:0;}
il int qpow(int a,int b) {int r=1; for(; b; b>>=1,a=mul(a,a)) if(b&1) r=mul(r,a); return r;}
il int mdinv(const int a) {return qpow(a,md-2);}
template<class ...Args>il int add(const int a,const int b,const Args &...args) {return add(add(a,b),args...);}
template<class ...Args>il int mul(const int a,const int b,const Args &...args) {return mul(mul(a,b),args...);}
} using namespace MOD_CALC;
namespace i207M
{
#pragma endregion
namespace Polynomial
{
const int Primitive_Root=3;
il int fit2(int x) {return 1<<(31-__builtin_clz(x)+(__builtin_popcount(x)!=1));}
struct Poly
{
	vector<int>f;
	Poly() {}
	explicit Poly(int siz) {resize(siz);}
	Poly(const vector<int> &tf):f(tf) {}
	Poly(const initializer_list<int> &tf):f(tf) {}
	Poly(const int n,const Poly &F) {resize(n); memcpy(&f[0],&F.f[0],sizeof(int)*n);}
	il int size() const {return Size(f);}
	il void clear() {f.clear();}
	il void resize(int siz) {f.resize(siz);}
	il int &operator[](const int x) {return f[x];}
	il const int &operator[](const int x) const {return f[x];}
	il int *begin() {return &f[0];}
	il int *end() {return &f.back()+1;}
	il void read(int n) {resize(n); for(ri i=0; i<n; ++i) in(f[i]);}
	il void print() const {for(ri i=0; i<Size(f); ++i) out(f[i],i==Size(f)-1?'\n':' ');}
	il void rev() {reverse(f.begin(),f.end());}
	il int value(int v) const {int r=0; for(ri i=Size(f)-1; i>=0; --i) r=add(mul(r,v),f[i]); return r;}
};
namespace Bitrev
{
vector<int>r;
void rev(int n,int f[])
{
	if(Size(r)!=n)
	{
		r.resize(n);
		for(ri i=0,hb=n>>1; i<n; ++i) r[i]=(r[i>>1]>>1)|((i&1)?hb:0);
	}
	for(ri i=0; i<n; ++i) if(i<r[i]) swap(f[i],f[r[i]]);
}
}
void dft(int n,int f[],int op)
{
	if(op==-1) reverse(f+1,f+n);
	Bitrev::rev(n,f);
	for(ri p=2; p<=n; p<<=1)
	{
		int len=p>>1,nx=qpow(Primitive_Root,(md-1)/p);
		for(ri k=0,w=1; k<n; k+=p,w=1)
			for(ri i=k; i<k+len; ++i)
			{
				int t=mul(w,f[i+len]);
				f[i+len]=sub(f[i],t),f[i]=add(f[i],t);
				w=mul(w,nx);
			}
	}
	if(op==-1)
	{
		int invn=mdinv(n);
		for(ri i=0; i<n; ++i) f[i]=mul(f[i],invn);
	}
}
il void dft(Poly &F,int op) {dft(F.size(),F.begin(),op);}
Poly Inv(int n,const Poly &A)
{
	if(n==1) return {mdinv(A[0])};
	int m=fit2(n<<1);
	Poly B(m),C=Inv((n+1)>>1,A); C.resize(m);
	for(ri i=0; i<n; ++i) B[i]=A[i];
	dft(B,1),dft(C,1);
	for(ri i=0; i<m; ++i) B[i]=C[i]*(2-(LL)B[i]*C[i]%md+md)%md;
	dft(B,-1); B.resize(n);
	return B;
}
il void operator+=(Poly &A,const Poly &B)
{
	if(Size(B)>Size(A)) A.resize(Size(B));
	for(ri i=0; i<Size(B); ++i) inc(A[i],B[i]);
}
il Poly operator+(Poly A,const Poly &B) {A+=B; return A;}
il void operator-=(Poly &A,const Poly &B)
{
	if(Size(B)>Size(A)) A.resize(Size(B));
	for(ri i=0; i<Size(B); ++i) dec(A[i],B[i]);
}
il Poly operator-(Poly A,const Poly &B) {A-=B; return A;}
il Poly operator-(Poly A) {for(ri i=0; i<Size(A); ++i) A[i]=md-A[i]; return A;}
il void operator*=(Poly &A,Poly B)
{
	int n=Size(A)+Size(B)-1,m=fit2(n);
	A.resize(m),B.resize(m); dft(A,1),dft(B,1);
	for(ri i=0; i<m; ++i) A[i]=mul(A[i],B[i]);
	dft(A,-1); A.resize(n);
}
il Poly operator*(Poly A,const Poly &B) {A*=B; return A;}
il void operator*=(Poly &A,const int v) {for(ri i=0; i<Size(A); ++i) A[i]=mul(A[i],v);}
il Poly operator*(Poly A,const int v) {A*=v; return A;}
il void Mul(Poly &A,const Poly &B) {int t=Size(A); A*=B; A.resize(t);}
il Poly Mul2(Poly A,const Poly &B) {Mul(A,B); return A;}
il Poly operator~(const Poly &F) {return Inv(Size(F),F);}
il Poly operator/(const Poly &A,const Poly &B)
{
	if(Size(A)<Size(B)) return {0};
	Poly F=A,G=B; F.rev(),G.rev();
	int t=Size(A)-Size(B)+1; G.resize(t);
	F*=~G; F.resize(t); F.rev(); return F;
}
il void operator/=(Poly &A,const Poly &B) {A=A/B;}
il Poly operator%(const Poly &A,const Poly &B)
{
	if(Size(A)<Size(B)) return A;
	Poly C=A-A/B*B; C.resize(Size(B)-1); return C;
}
il void operator%=(Poly &A,const Poly &B) {A=A%B;}
il Poly Qpow(Poly A,int b,const Poly &Md)
{
	Poly R= {1};
	for(; b; b>>=1,A=A*A%Md) if(b&1) R=R*A%Md;
	return R;
}
il void operator<<=(Poly &A,const int s)
{
	A.resize(Size(A)+s);
	for(ri i=Size(A)-1; i>=0; --i) A[i+s]=A[i];
	for(ri i=0; i<s; ++i) A[i]=0;
}
il Poly operator<<(Poly A,const int s) {A<<=s; return A;}
il void operator>>=(Poly &A,const int s) {for(ri i=s; i<Size(A); ++i) A[i-s]=A[i]; A.resize(Size(A)-s);}
il Poly operator>>(Poly A,const int s) {A>>=s; return A;}
Poly Sqrt(int n,const Poly &A) // assume that constant is 1
{
	if(n==1) return {1};
	Poly B(n,A),C=Sqrt((n+1)>>1,A); C.resize(n);
	Mul(B,~C);
	for(ri i=0; i<n; ++i) B[i]=mul(add(B[i],C[i]),inv2);
	return B;
}
il Poly Sqrt(const Poly &A) {return Sqrt(A.size(),A);}
il Poly delta(const Poly &A)
{
	Poly B(Size(A)-1);
	for(ri i=1; i<Size(A); ++i) B[i-1]=mul(A[i],i);
	return B;
}
il Poly inter(const Poly &A)
{
	static vector<int> iv= {0,1};
	Poly B(Size(A)+1);
	if(Size(iv)<Size(B))
	{
		int t=Size(iv); iv.resize(Size(B));
		for(ri i=t; i<Size(iv); ++i) iv[i]=mul(md-md/i,iv[md%i]);
	}
	for(ri i=1; i<Size(B); ++i) B[i]=mul(A[i-1],iv[i]);
	return B;
}
il Poly Ln(const Poly &A) // assume that constant is 1
{
	Poly B=delta(A)*~A; B.resize(Size(A)-1);
	return inter(B);
}
Poly Exp(int n,const Poly &A) // assume that constant is 0
{
	if(n==1) return {1};
	Poly B(n,A),C=Exp((n+1)>>1,A); C.resize(n);
	B-=Ln(C); ++B[0]; Mul(B,C);
	return B;
}
il Poly Exp(const Poly &A) {return Exp(Size(A),A);}
il Poly operator^(Poly A,const int K) // assume that constant is 1
{
	A=Ln(A); for(ri i=0; i<Size(A); ++i) A[i]=mul(A[i],K);
	return Exp(A);
}
} using namespace Polynomial;
#define N 100005
int n,K;
int fac[N],kf[N];
vector<int>E[N];
int sz[N];
int dp[N];
int A[N],B[N],C;
pair<Poly,Poly> build(int l,int r)
{
	if(l==r) return mp(Poly({B[l],mul(B[l],C)}), Poly({1,A[l]}));
	gm; auto ls=build(l,mid),rs=build(mid+1,r);
	return mp(ls.fi*rs.se+ls.se*rs.fi,ls.se*rs.se);
}
int ans;
void dfs(int x,int _fa)
{
	sz[x]=1;
	for(solid v:E[x])
	{
		if(v==_fa) continue;
		dfs(v,x); sz[x]+=sz[v];
	}
	if(sz[x]==1)
	{
		dp[x]=1;
		return;
	}
	int cnt=0;
	for(solid v:E[x])
	{
		if(v==_fa) continue;
		A[++cnt]=sz[v],B[cnt]=dp[v];
	}
	C=n-sz[x];
	auto t=build(1,n);
	int mx=min(Size(t.fi)-1,K);
	int &sum=dp[x];
	for(solid v:E[x])
	{
		if(v==_fa) continue;
		inc(ans,mul(sum,dp[v]));
		inc(sum,dp[v]);
	}
	for(ri i=0; i<=mx; ++i)
	{
		inc(ans,mul(t.fi[i],kf[i]));
		inc(sum,mul(t.se[i],kf[i]));
	}
}
signed main()
{
#ifdef M207
	freopen("in.in","r",stdin);
	// freopen("ot.out","w",stdout);
#endif
	in(n,K);
	for(ri i=1,a,b; i<n; ++i)
	{
		in(a,b);
		E[a].pb(b),E[b].pb(a);
	}
	fac[0]=1;
	for(ri i=1; i<=K; ++i) fac[i]=mul(fac[i-1],i);
	for(ri i=0; i<=K; ++i) kf[i]=mul(fac[K],mdinv(fac[K-i]));
	dfs(1,0);
	out(ans);
	return 0;
}
#pragma region
}
signed main()
{
	i207M::main();
	return 0;
}
#pragma endregion


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>

#define N 101000
#define ll long long
#define MOD 998244353
#define RG register
#define pb push_back

using namespace std;

inline int read(){
    RG int x=0,t=1;RG char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
    if(ch=='-')t=-1,ch=getchar();
    while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
    return x*t;
}

int sum[N],inv[N],iv[N];
inline int A(int x,int y) { if(x<y||y<0) return 0; return 1LL*sum[x]*inv[x-y]%MOD; }
inline int Plu(const int &x,const int &y) { return x+y>=MOD?x+y-MOD:x+y; }
inline int Pow(int x,int y){ int ans=1;
	while(y) { if(y&1) ans=1LL*ans*x%MOD; x=1LL*x*x%MOD,y>>=1; }
	return ans;
}
struct NTT{
	int a[N<<2],b[N<<2],r[N<<2],W[N<<2];
	inline int Get(int &n) { int en=n,l=0; for(n=1;n<en;n<<=1) ++l; return l-1; }
	inline void Trans(int *P,int n,int op){
		int l=Get(n); for(RG int i=0;i<n;++i) r[i]=(r[i>>1]>>1)|((i&1)<<l);
		for(RG int i=0;i<n;++i) if(r[i]<i) swap(P[i],P[r[i]]);
		for(RG int i=1;i<n;i<<=1){
			int w=Pow(3,(MOD-1)/(i<<1));
			if(op==-1) w=Pow(w,MOD-2); W[0]=1;
			for(RG int k=1;k<i;++k) W[k]=1LL*W[k-1]*w%MOD;
			for(RG int p=i<<1,j=0;j<n;j+=p)
				for(RG int k=0;k<i;++k){
					int X=P[j+k],Y=1LL*P[i+j+k]*W[k]%MOD;
					P[j+k]=Plu(X,Y),P[i+j+k]=Plu(X,MOD-Y);
				}
		}
		if(op==-1)
			for(RG int i=0,Inv=Pow(n,MOD-2);i<n;++i)
				P[i]=1LL*P[i]*Inv%MOD;
	}
	inline void Mul(int *A,int *B,int *C,int n){
		for(RG int i=0;i<n;++i) a[i]=A[i],b[i]=B[i];
		n<<=1,Get(n),Trans(a,n,1),Trans(b,n,1);
		for(RG int i=0;i<n;++i) a[i]=1LL*a[i]*b[i]%MOD;
		Trans(a,n,-1); for(RG int i=0;i<n;++i) C[i]=a[i],a[i]=b[i]=0;
	}
}   F;

int f[20][N<<2],g[N<<2],tmp[N<<2];
inline void CDQ(int l,int r,int lv){
	if(l==r) { f[lv][0]=1,f[lv][1]=g[l]; return ; }
	int mid=(l+r)>>1,len=mid-l+2; CDQ(l,mid,lv+1);
	for(RG int i=0;i<len;++i) f[lv][i]=f[lv+1][i],f[lv+1][i]=0;
	CDQ(mid+1,r,lv+1),F.Mul(f[lv],f[lv+1],f[lv],len);
	for(RG int i=0;i<len;++i) f[lv+1][i]=0;
}

int n,K,top,first[N],siz[N],ans,h[N]; vector<int> V[N];
struct mona { int nxt,en; } s[N<<1];
inline void Insert(int x,int y) { s[++top]=(mona) { first[x],y },first[x]=top; }

inline bool cmp(int x,int y) { return siz[x]<siz[y]; }
inline int Get(int *a,int n){
	int ans=0;
	for(RG int i=0;i<=n;++i) ans=(1LL*a[i]*A(K,i)+ans)%MOD;
	return ans;
}
inline void Calc(vector<int> A,int n,int val,int *B){
	for(RG int i=n;i;--i){
		int t=1LL*iv[val]*A[i]%MOD;
		B[i-1]=t,A[i-1]=Plu(A[i-1],MOD-t);
	}   return ;
}
inline void Dfs(int k,int fa){
	siz[k]=1;
	for(RG int i=first[k];i;i=s[i].nxt){
		int en=s[i].en; if(en==fa) continue ;
		Dfs(en,k),siz[k]+=siz[en];
	}   return ;
}
inline void Dfs(int k,int fa,int tf){ int tot=0;
	for(RG int i=first[k];i;i=s[i].nxt){
		int en=s[i].en; if(en==fa) continue ;
		g[++tot]=siz[en],V[k].pb(en);
	}   if(!tot) { ans=Plu(ans,tf),h[k]=1; return ; }
	CDQ(1,tot,0); int now=Get(f[0],tot);
	sort(V[k].begin(),V[k].end(),cmp),ans=(1LL*now*tf+ans)%MOD;
	int lst=0,t=n-siz[k]; vector<int> p(tot+2);
	for(RG int i=0;i<=tot;++i) p[i]=f[0][i],f[0][i]=0; p[tot+1]=0;
	for(RG int i=tot+1;i;--i) p[i]=(1LL*p[i-1]*t+p[i])%MOD;
	for(RG int i=0,j=V[k].size();i<j;++i){
		int en=V[k][i]; if(en==fa) continue ;
		if(!i||en!=V[k][i-1]) Calc(p,tot+1,siz[en],tmp),lst=Get(tmp,tot);
		Dfs(en,k,Plu(tf,lst)),ans=(1LL*h[k]*h[en]+ans)%MOD,h[k]=Plu(h[k],h[en]);
	}   h[k]=Plu(h[k],now); return ;
}

int main(){
	n=read(),K=read(),sum[0]=inv[0]=iv[0]=1;
	if(K==1) { printf("%lld\n",1LL*n*(n-1)/2%MOD); return 0; }
	for(RG int i=1;i<=n;++i) iv[i]=Pow(i,MOD-2);
	for(RG int i=1;i<=n;++i) sum[i]=1LL*sum[i-1]*i%MOD,inv[i]=Pow(sum[i],MOD-2);
	for(RG int i=1;i<n;++i){
		int x=read(),y=read();
		Insert(x,y),Insert(y,x);
	}   Dfs(1,0),Dfs(1,0,0),printf("%d\n",ans);
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>

#define N 101000
#define ll long long
#define MOD 998244353
#define RG register
#define pb push_back

using namespace std;

inline int read(){
    RG int x=0,t=1;RG char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
    if(ch=='-')t=-1,ch=getchar();
    while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
    return x*t;
}

int sum[N],inv[N],iv[N];
inline int A(int x,int y) { if(x<y||y<0) return 0; return 1LL*sum[x]*inv[x-y]%MOD; }
inline int Plu(const int &x,const int &y) { return x+y>=MOD?x+y-MOD:x+y; }
inline int Pow(int x,int y){ int ans=1;
	while(y) { if(y&1) ans=1LL*ans*x%MOD; x=1LL*x*x%MOD,y>>=1; }
	return ans;
}
struct NTT{
	int a[N<<2],b[N<<2],r[N<<2],W[N<<2];
	inline int Get(int &n) { int en=n,l=0; for(n=1;n<en;n<<=1) ++l; return l-1; }
	inline void Trans(int *P,int n,int op){
		int l=Get(n); for(RG int i=0;i<n;++i) r[i]=(r[i>>1]>>1)|((i&1)<<l);
		for(RG int i=0;i<n;++i) if(r[i]<i) swap(P[i],P[r[i]]);
		for(RG int i=1;i<n;i<<=1){
			int w=Pow(3,(MOD-1)/(i<<1));
			if(op==-1) w=Pow(w,MOD-2); W[0]=1;
			for(RG int k=1;k<i;++k) W[k]=1LL*W[k-1]*w%MOD;
			for(RG int p=i<<1,j=0;j<n;j+=p)
				for(RG int k=0;k<i;++k){
					int X=P[j+k],Y=1LL*P[i+j+k]*W[k]%MOD;
					P[j+k]=Plu(X,Y),P[i+j+k]=Plu(X,MOD-Y);
				}
		}
		if(op==-1)
			for(RG int i=0,Inv=Pow(n,MOD-2);i<n;++i)
				P[i]=1LL*P[i]*Inv%MOD;
	}
	inline void Mul(int *A,int *B,int *C,int n){
		for(RG int i=0;i<n;++i) a[i]=A[i],b[i]=B[i];
		n<<=1,Get(n),Trans(a,n,1),Trans(b,n,1);
		for(RG int i=0;i<n;++i) a[i]=1LL*a[i]*b[i]%MOD;
		Trans(a,n,-1); for(RG int i=0;i<n;++i) C[i]=a[i],a[i]=b[i]=0;
	}
}   F;

int f[20][N<<2],g[N<<2],tmp[N<<2];
inline void CDQ(int l,int r,int lv){
	if(l==r) { f[lv][0]=1,f[lv][1]=g[l]; return ; }
	int mid=(l+r)>>1,len=mid-l+2; CDQ(l,mid,lv+1);
	for(RG int i=0;i<len;++i) f[lv][i]=f[lv+1][i],f[lv+1][i]=0;
	CDQ(mid+1,r,lv+1),F.Mul(f[lv],f[lv+1],f[lv],len);
	for(RG int i=0;i<len;++i) f[lv+1][i]=0;
}

int n,K,top,first[N],siz[N],ans,h[N]; vector<int> V[N];
struct mona { int nxt,en; } s[N<<1];
inline void Insert(int x,int y) { s[++top]=(mona) { first[x],y },first[x]=top; }

inline bool cmp(int x,int y) { return siz[x]<siz[y]; }
inline int Get(int *a,int n){
	int ans=0;
	for(RG int i=0;i<=n;++i) ans=(1LL*a[i]*A(K,i)+ans)%MOD;
	return ans;
}
inline void Calc(vector<int> A,int n,int val,int *B){
	for(RG int i=n;i;--i){
		int t=1LL*iv[val]*A[i]%MOD;
		B[i-1]=t,A[i-1]=Plu(A[i-1],MOD-t);
	}   return ;
}
inline void Dfs(int k,int fa){
	siz[k]=1;
	for(RG int i=first[k];i;i=s[i].nxt){
		int en=s[i].en; if(en==fa) continue ;
		Dfs(en,k),siz[k]+=siz[en];
	}   return ;
}
inline void Dfs(int k,int fa,int tf){ int tot=0;
	for(RG int i=first[k];i;i=s[i].nxt){
		int en=s[i].en; if(en==fa) continue ;
		g[++tot]=siz[en],V[k].pb(en);
	}   if(!tot) { ans=Plu(ans,tf),h[k]=1; return ; }
	CDQ(1,tot,0); int now=Get(f[0],tot);
	sort(V[k].begin(),V[k].end(),cmp),ans=(1LL*now*tf+ans)%MOD;
	int lst=0,t=n-siz[k]; vector<int> p(tot+2);
	for(RG int i=0;i<=tot;++i) p[i]=f[0][i],f[0][i]=0; p[tot+1]=0;
	for(RG int i=tot+1;i;--i) p[i]=(1LL*p[i-1]*t+p[i])%MOD;
	for(RG int i=0,j=V[k].size();i<j;++i){
		int en=V[k][i]; if(en==fa) continue ;
		if(!i||siz[en]!=siz[V[k][i-1]]) Calc(p,tot+1,siz[en],tmp),lst=Get(tmp,tot);
		Dfs(en,k,Plu(tf,lst)),ans=(1LL*h[k]*h[en]+ans)%MOD,h[k]=Plu(h[k],h[en]);
	}   h[k]=Plu(h[k],now); return ;
}

int main(){
	n=read(),K=read(),sum[0]=inv[0]=iv[0]=1; int Mx=max(n,K);
	if(K==1) { printf("%lld\n",1LL*n*(n-1)/2%MOD); return 0; }
	for(RG int i=1;i<=Mx;++i) iv[i]=Pow(i,MOD-2);
	for(RG int i=1;i<=Mx;++i) sum[i]=1LL*sum[i-1]*i%MOD,inv[i]=Pow(sum[i],MOD-2);
	for(RG int i=1;i<n;++i){
		int x=read(),y=read();
		Insert(x,y),Insert(y,x);
	}   Dfs(1,0),Dfs(1,0,0),printf("%d\n",ans);
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>

#define N 101000
#define ll long long
#define MOD 998244353
#define RG register
#define pb push_back

using namespace std;

inline int read(){
    RG int x=0,t=1;RG char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
    if(ch=='-')t=-1,ch=getchar();
    while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
    return x*t;
}

int sum[N],inv[N],iv[N];
inline int A(int x,int y) { if(x<y||y<0) return 0; return 1LL*sum[x]*inv[x-y]%MOD; }
inline int Plu(const int &x,const int &y) { return x+y>=MOD?x+y-MOD:x+y; }
inline int Pow(int x,int y){ int ans=1;
	while(y) { if(y&1) ans=1LL*ans*x%MOD; x=1LL*x*x%MOD,y>>=1; }
	return ans;
}
struct NTT{
	int a[N<<2],b[N<<2],r[N<<2],W[N<<2];
	inline int Get(int &n) { int en=n,l=0; for(n=1;n<en;n<<=1) ++l; return l-1; }
	inline void Trans(int *P,int n,int op){
		int l=Get(n); for(RG int i=0;i<n;++i) r[i]=(r[i>>1]>>1)|((i&1)<<l);
		for(RG int i=0;i<n;++i) if(r[i]<i) swap(P[i],P[r[i]]);
		for(RG int i=1;i<n;i<<=1){
			int w=Pow(3,(MOD-1)/(i<<1));
			if(op==-1) w=Pow(w,MOD-2); W[0]=1;
			for(RG int k=1;k<i;++k) W[k]=1LL*W[k-1]*w%MOD;
			for(RG int p=i<<1,j=0;j<n;j+=p)
				for(RG int k=0;k<i;++k){
					int X=P[j+k],Y=1LL*P[i+j+k]*W[k]%MOD;
					P[j+k]=Plu(X,Y),P[i+j+k]=Plu(X,MOD-Y);
				}
		}
		if(op==-1)
			for(RG int i=0,Inv=Pow(n,MOD-2);i<n;++i)
				P[i]=1LL*P[i]*Inv%MOD;
	}
	inline void Mul(int *A,int *B,int *C,int n){
		for(RG int i=0;i<n;++i) a[i]=A[i],b[i]=B[i];
		n<<=1,Get(n),Trans(a,n,1),Trans(b,n,1);
		for(RG int i=0;i<n;++i) a[i]=1LL*a[i]*b[i]%MOD;
		Trans(a,n,-1); for(RG int i=0;i<n;++i) C[i]=a[i],a[i]=b[i]=0;
	}
}   F;

int f[20][N<<2],g[N<<2],tmp[N<<2];
inline void CDQ(int l,int r,int lv){
	if(l==r) { f[lv][0]=1,f[lv][1]=g[l]; return ; }
	int mid=(l+r)>>1,len=mid-l+2; CDQ(l,mid,lv+1);
	for(RG int i=0;i<len;++i) f[lv][i]=f[lv+1][i],f[lv+1][i]=0;
	CDQ(mid+1,r,lv+1),F.Mul(f[lv],f[lv+1],f[lv],len);
	for(RG int i=0;i<len;++i) f[lv+1][i]=0;
}

int n,K,top,first[N],siz[N],ans,h[N]; vector<int> V[N];
struct mona { int nxt,en; } s[N<<1];
inline void Insert(int x,int y) { s[++top]=(mona) { first[x],y },first[x]=top; }

inline bool cmp(int x,int y) { return siz[x]<siz[y]; }
inline int Get(int *a,int n){
	int ans=0;
	for(RG int i=0;i<=n;++i) ans=(1LL*a[i]*A(K,i)+ans)%MOD;
	return ans;
}
inline void Calc(vector<int> A,int n,int val,int *B){
	for(RG int i=n;i;--i){
		int t=1LL*iv[val]*A[i]%MOD;
		B[i-1]=t,A[i-1]=Plu(A[i-1],MOD-t);
	}   return ;
}
inline void Dfs(int k,int fa){
	siz[k]=1;
	for(RG int i=first[k];i;i=s[i].nxt){
		int en=s[i].en; if(en==fa) continue ;
		Dfs(en,k),siz[k]+=siz[en];
	}   return ;
}
inline void Dfs(int k,int fa,int tf){ int tot=0;
	for(RG int i=first[k];i;i=s[i].nxt){
		int en=s[i].en; if(en==fa) continue ;
		g[++tot]=siz[en],V[k].pb(en);
	}   if(!tot) { ans=Plu(ans,tf),h[k]=1; return ; }
	CDQ(1,tot,0); int now=Get(f[0],tot);
	sort(V[k].begin(),V[k].end(),cmp),ans=(1LL*now*tf+ans)%MOD;
	int lst=0,t=n-siz[k]; vector<int> p(tot+2);
	for(RG int i=0;i<=tot;++i) p[i]=f[0][i],f[0][i]=0; p[tot+1]=0;
	for(RG int i=tot+1;i;--i) p[i]=(1LL*p[i-1]*t+p[i])%MOD;
	for(RG int i=0,j=V[k].size();i<j;++i){
		int en=V[k][i]; if(en==fa) continue ;
		if(!i||siz[en]!=siz[V[k][i-1]]) Calc(p,tot+1,siz[en],tmp),lst=Get(tmp,tot);
		Dfs(en,k,Plu(tf,lst)),ans=(1LL*h[k]*h[en]+ans)%MOD,h[k]=Plu(h[k],h[en]);
	}   h[k]=Plu(h[k],now); return ;
}

int main(){
	n=read(),K=read(),sum[0]=inv[0]=iv[0]=1;
	if(K==1) { printf("%lld\n",1LL*n*(n-1)/2%MOD); return 0; }
	for(RG int i=1;i<=n;++i) iv[i]=Pow(i,MOD-2);
	for(RG int i=1;i<=n;++i) sum[i]=1LL*sum[i-1]*i%MOD,inv[i]=Pow(sum[i],MOD-2);
	for(RG int i=1;i<n;++i){
		int x=read(),y=read();
		Insert(x,y),Insert(y,x);
	}   Dfs(1,0),Dfs(1,0,0),printf("%d\n",ans);
}


#include <cstdlib>
#include <iostream>
#include <cstdio>
//#include <math.h>
#include <cstring>
#include <time.h>
#include <complex>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>

#pragma GCC optimize(3)
#pragma warning(disable:4996)
#define lowbit(a) ((a)&-(a))

template<typename T> T min(T x, T y)
{
    return x < y ? x : y;
}
template<typename T> T max(T x, T y)
{
    return x > y ? x : y;
};

const long long MAXN = 500005;
const long long mod = 998244353;

long long fac[MAXN];

void print(long long *a, int n)
{
	for(int i = 0; i < n; i++)
		printf("%I64d%c", a[i], i == n - 1 ? '\n' : ' ');
}

long long qpow(long long x, long long y)
{
	if(!y)
		return 1;
	long long t = qpow(x, y/2);
	t = t*t % mod;
	if(y&1)
		t = t*x % mod;
	return t;
}

int log2(int n)
{
	int t = 0;
	while(1 << t <= n)
		t++;
	return t - 1;
}
int rev(int x, int len)
{
	int y = 0;
	for(int i = 0; i < len; i++)
		if(x & (1 << i))
			y += 1 << (len - 1 - i);
	return y;
}
void NTT(long long *a, int n, int flag)
{
	static long long temp[MAXN];
	int len = log2(n);
	for(int i = 0; i < n; i++)
		temp[rev(i, len)] = a[i];
	for(int i = 0; i < n; i++)
		a[i] = temp[i] % mod;
	for(int L = 2; L <= n; L *= 2)
	{
		int mid = L / 2;
		long long w = qpow(3, mod - 1 + flag * (mod - 1) / L);
		for(int i = 0; i < n; i += L)
		{
			long long tw = 1;
			for(int j = i; j < i + mid; j++)
			{
				long long t = tw*a[j + mid] % mod;
				a[j + mid] = (a[j] - t) % mod;
				a[j] = (a[j] + t) % mod;
				tw = tw*w % mod;
			}
		}
	}
	if(flag == -1)
	{
		long long inv = qpow(n, mod - 2);
		for(int i = 0; i < n; i++)
			a[i] = (a[i]*inv % mod + mod) % mod;
	}
}

void calc(long long *a, int n, long long *out)
{
	if(n == 1)
	{
		out[0] = 1;
		out[1] = a[0];
		return;
	}
	int mid = n / 2;
	int t = log2(mid + 2) + 2;
	long long *tmp1 = new long long[1 << t];
	long long *tmp2 = new long long[1 << t];
	long long *a1 = new long long[mid];
	long long *a2 = new long long[n - mid];
	memset(tmp1, 0, sizeof(long long)*(1 << t));
	memset(tmp2, 0, sizeof(long long)*(1 << t));
	memcpy(a1, a, sizeof(long long)*mid);
	memcpy(a2, a + mid, sizeof(long long)*(n - mid));

	calc(a1, mid, tmp1);
	calc(a2, n - mid, tmp2);
	NTT(tmp1, 1 << t, 1);
	NTT(tmp2, 1 << t, 1);
	for(int i = 0; i < (1 << t); i++)
		out[i] = tmp1[i]*tmp2[i] % mod;
	NTT(out, 1 << t, -1);

	delete tmp1;
	delete tmp2;
	delete a1;
	delete a2;
}

void mul(long long *a, int n, long long t)
{
	for(int i = n; i > 0; i--)
		a[i] = (a[i] + a[i - 1]*t % mod) % mod;
}
void div(long long *a, int n, long long t)
{
	static long long temp[MAXN];
	for(int i = n - 2; i >= 0; i--)
	{
		temp[i] = a[i + 1]*qpow(t, mod - 2) % mod;
		a[i] = (a[i] - temp[i]) % mod;
	}
	for(int i = 0; i < n - 1; i++)
		a[i] = (temp[i] + mod) % mod;
	a[n - 1] = 0;
}

struct node{
	int to;
	node *next;
};
void addnode(node *&head, int to)
{
	node *p = new node;
	p->to = to;
	p->next = head;
	head = p;
}

int N, K;
long long ans;
node *edge[MAXN];
long long size[MAXN], deg[MAXN], f[MAXN], g[MAXN];
long long *P[MAXN];

void getf(int v, int fa)
{
	size[v] = 1;
	for(node *p = edge[v]; p; p = p->next)
	{
		if(p->to == fa)
			continue;
		getf(p->to, v);
		deg[v]++;
		size[v] += size[p->to];
		g[v] = (g[v] + g[p->to]) % mod;
	}
	if(!deg[v])
	{
		f[v] = g[v] = 1;
		return;
	}
	int t = log2((int)deg[v] + 5) + 2;//printf("# %d %I64d %d\n", v, deg[v], t);
	long long *a = new long long[deg[v]];
	long long *tmp = new long long[1 << t];
	memset(tmp, 0, sizeof(long long)*(1 << t));
	int cur = 0;
	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			a[cur++] = size[p->to];
	calc(a, deg[v], tmp);
	for(int i = 0; i <= K && i <= deg[v]; i++)
		f[v] = (f[v] + tmp[i]*fac[K]%mod * qpow(fac[K - i], mod - 2)%mod) % mod;
	g[v] = (g[v] + f[v]) % mod;
	delete a;
	P[v] = tmp;
}
void dfs(int v, int fa)
{
	long long cur = 0;
	for(node *p = edge[v]; p; p = p->next)
	{
		if(p->to == fa)
			continue;
		ans = (ans + cur*g[p->to]) % mod;
		cur = (cur + g[p->to]) % mod;
		dfs(p->to, v);
	}
}
void final(int v, int fa)
{
	if(!deg[v])
		return;

	mul(P[v], deg[v] + 1, N - size[v]);
	std::pair<int, int> *tmp = new std::pair<int, int>[deg[v]];
	int cur = 0;
	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			tmp[cur++] = std::make_pair(size[p->to], p->to);
	std::sort(tmp, tmp + deg[v]);

	div(P[v], deg[v] + 2, tmp[0].first);
	for(int i = 0; i < deg[v]; i++)
	{
		if(i && tmp[i].first != tmp[i - 1].first)
		{
			mul(P[v], deg[v] + 1, tmp[i - 1].first);
			div(P[v], deg[v] + 2, tmp[i].first);
		}
		for(int j = 0; j <= K && j <= deg[v]; j++)
			ans = (ans + g[tmp[i].second]*P[v][j] % mod * fac[K] % mod * qpow(fac[K - j], mod - 2) %mod) % mod;
	}

	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			final(p->to, v);
}

void solve()
{//printf("***\n");
	if(K == 1)
	{
		printf("%I64d\n", 1ll*N*(N - 1) / 2 % mod);
		return;
	}

	getf(1, 0);
	dfs(1, 0);
	final(1, 0);
	printf("%I64d\n", ans);
}

void init()
{
	fac[0] = 1;
	for(int i = 1; i < MAXN; i++)
		fac[i] = fac[i - 1]*i % mod;

	int u, v;
	scanf("%d %d", &N, &K);
	for(int i = 1; i < N; i++)
	{
		scanf("%d %d", &u, &v);
		addnode(edge[u], v);
		addnode(edge[v], u);
	}
}

int main1()
{
	long long test[100] = { 1,2,3,4,5 };

	print(test, 10);
	mul(test, 5, 233333);
    print(test, 10);
    div(test, 6, 233333);
    print(test, 10);

    return 0;
}
int main()
{
	init();
	solve();

	return 0;
}


#include <cstdlib>
#include <iostream>
#include <cstdio>
#include <math.h>
#include <cstring>
#include <time.h>
#include <complex>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>

//#pragma GCC optimize(3)
#pragma warning(disable:4996)
#define lowbit(a) ((a)&-(a))

template<typename T> T min(T x, T y)
{
    return x < y ? x : y;
}
template<typename T> T max(T x, T y)
{
    return x > y ? x : y;
};

const int MAXN = 500005;
const int mod = 998244353;

namespace copy{
	const int Maxn = MAXN;
	inline int Ksm(int a,int x) {
	    int rec=1; while(x) {if(x&1) rec=1ll*rec*a%mod; a=1ll*a*a%mod; x>>=1;} return rec;
	}
	int D, rev, R[Maxn],temp[Maxn];
	inline void Ntt(int *x,int N,int f) {
	    for(int i=0;i<N;++i) temp[i]=x[R[i]];
	    for(int i=0;i<N;++i) x[i]=temp[i]; temp[0]=1;
	    for(int s=2;s<=N;s<<=1) {
	        int wn=Ksm(3,(f*(mod-1)/s+mod-1)%(mod-1));
	        for(int j=1;j<(s>>1);++j) temp[j]=1ll*temp[j-1]*wn%mod;
	        for(int k=0;k<N;k+=s) {
	            int u,t;
	            for(int j=0;j<(s>>1);++j) {
	                u=x[k+j]; t=1ll*temp[j]*x[k+j+(s>>1)]%mod;
	                x[k+j]=(u+t)%mod; x[k+j+(s>>1)]=(u-t+mod)%mod;
	            }
	        }
	    } if(f==-1) for(int i=0;i<N;++i) x[i]=1ll*x[i]*rev%mod;
	    return ;
	}
	void init(int N)
	{
		D = 0;
		while(1 << D < N)
			D++;
		for(int i=0;i<N;++i)
			R[i]=(R[i>>1]>>1)|((i&1)<<(D-1));
		rev = Ksm(N,mod-2);
		for(int i = 0; i < N; i++)
			temp[i] = 0;
	}
}

int fac[MAXN];

void print(int *a, int n)
{
	for(int i = 0; i < n; i++)
		printf("%d%c", a[i], i == n - 1 ? '\n' : ' ');
}

int qpow(int x, int y)
{
	if(!y)
		return 1;
	int t = qpow(x, y/2);
	t = 1ll*t*t % mod;
	if(y&1)
		t = 1ll*t*x % mod;
	return t;
}

int log2(int n)
{
	int t = 0;
	while(1 << t <= n)
		t++;
	return t - 1;
}
int rev(int x, int len)
{
	int y = 0;
	for(int i = 0; i < len; i++)
		if(x & (1 << i))
			y += 1 << (len - 1 - i);
	return y;
}
void NTT(int *a, int n, int flag)
{
	copy::init(n);
	copy::Ntt(a, n, flag);
	return;

	static int temp[MAXN];
	int len = log2(n);
	for(int i = 0; i < n; i++)
		temp[rev(i, len)] = a[i];
	for(int i = 0; i < n; i++)
		a[i] = temp[i] % mod;
	for(int L = 2; L <= n; L *= 2)
	{
		int mid = L / 2;
		int w = qpow(3, mod - 1 + flag * (mod - 1) / L);
		for(int i = 0; i < n; i += L)
		{
			int tw = 1;
			for(int j = i; j < i + mid; j++)
			{
				int t = tw*a[j + mid] % mod;
				a[j + mid] = (a[j] - t) % mod;
				a[j] = (a[j] + t) % mod;
				tw = tw*w % mod;
			}
		}
	}
	if(flag == -1)
	{
		int inv = qpow(n, mod - 2);
		for(int i = 0; i < n; i++)
			a[i] = (a[i]*inv % mod + mod) % mod;
	}
}

void calc(int *a, int n, int *out)
{
	if(n == 1)
	{
		out[0] = 1;
		out[1] = a[0];
		return;
	}
	int mid = n / 2;
	int t = 0;
	while((1 << t) < n + 1)
		t++;
	int *tmp1 = new int[1 << t];
	int *tmp2 = new int[1 << t];
	int *a1 = new int[mid];
	int *a2 = new int[n - mid];
	for(int i = 0; i < (1 << t); i++)
		tmp1[i] = tmp2[i] = 0;
	memcpy(a1, a, sizeof(int)*mid);
	memcpy(a2, a + mid, sizeof(int)*(n - mid));

	calc(a1, mid, tmp1);
	calc(a2, n - mid, tmp2);
	NTT(tmp1, 1 << t, 1);
	NTT(tmp2, 1 << t, 1);
	for(int i = 0; i < (1 << t); i++)
		out[i] = 1ll*tmp1[i]*tmp2[i] % mod;
	NTT(out, 1 << t, -1);

	delete tmp1;
	delete tmp2;
	delete a1;
	delete a2;
}

void mul(int *a, int n, int t)
{
	for(int i = n; i > 0; i--)
		a[i] = (a[i] + 1ll*a[i - 1]*t % mod) % mod;
}
void div(int *a, int n, int t)
{
	static int temp[MAXN];
	for(int i = n - 2; i >= 0; i--)
	{
		temp[i] = 1ll*a[i + 1]*qpow(t, mod - 2) % mod;
		a[i] = (a[i] - temp[i]) % mod;
	}
	for(int i = 0; i < n - 1; i++)
		a[i] = (temp[i] + mod) % mod;
	a[n - 1] = 0;
}

struct node{
	int to;
	node *next;
};
void addnode(node *&head, int to)
{
	node *p = new node;
	p->to = to;
	p->next = head;
	head = p;
}

int N, K;
int ans;
node *edge[MAXN];
int size[MAXN], deg[MAXN], f[MAXN], g[MAXN];
int *P[MAXN];

void getf(int v, int fa)
{
	size[v] = 1;
	for(node *p = edge[v]; p; p = p->next)
	{
		if(p->to == fa)
			continue;
		getf(p->to, v);
		deg[v]++;
		size[v] += size[p->to];
		g[v] = (g[v] + g[p->to]) % mod;
	}
	if(!deg[v])
	{
		f[v] = g[v] = 1;
		return;
	}
	int t = log2((int)deg[v] + 5) + 2;
	int *a = new int[deg[v]];
	int *tmp = new int[1 << t];
	memset(tmp, 0, sizeof(int)*(1 << t));
	int cur = 0;
	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			a[cur++] = size[p->to];
	calc(a, deg[v], tmp);
	for(int i = 0; i <= K && i <= deg[v]; i++)
		f[v] = (f[v] + 1ll*tmp[i]*fac[K]%mod * qpow(fac[K - i], mod - 2)%mod) % mod;
	g[v] = (g[v] + f[v]) % mod;
	delete a;
	P[v] = tmp;
}
void dfs(int v, int fa)
{
	int cur = 0;
	for(node *p = edge[v]; p; p = p->next)
	{
		if(p->to == fa)
			continue;
		ans = (ans + 1ll*cur*g[p->to]) % mod;
		cur = (cur + g[p->to]) % mod;
		dfs(p->to, v);
	}
}
void final(int v, int fa)
{
	if(!deg[v])
		return;

	mul(P[v], deg[v] + 1, N - size[v]);
	std::pair<int, int> *tmp = new std::pair<int, int>[deg[v]];
	int cur = 0;
	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			tmp[cur++] = std::make_pair(size[p->to], p->to);
	std::sort(tmp, tmp + deg[v]);

	div(P[v], deg[v] + 2, tmp[0].first);
	int temp = 0;
	for(int j = 0; j <= K && j <= deg[v]; j++)
		temp = (temp + 1ll*P[v][j] % mod * fac[K] % mod * qpow(fac[K - j], mod - 2) % mod) % mod;
	for(int i = 0; i < deg[v]; i++)
	{
		if(i && tmp[i].first != tmp[i - 1].first)
		{
			mul(P[v], deg[v] + 1, tmp[i - 1].first);
			div(P[v], deg[v] + 2, tmp[i].first);
			temp = 0;
			for(int j = 0; j <= K && j <= deg[v]; j++)
				temp = (temp + 1ll*P[v][j] % mod * fac[K] % mod * qpow(fac[K - j], mod - 2) %mod) % mod;
		}
		ans = (ans + 1ll*g[tmp[i].second]*temp) % mod;
	}

	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			final(p->to, v);
}

void solve()
{//printf("***\n");
	if(K == 1)
	{
		printf("%d\n", (int)(1ll*N*(N - 1) / 2 % mod));
		return;
	}

	getf(1, 0);
	dfs(1, 0);
	final(1, 0);
	printf("%d\n", ans);
}
bool flag = true;
void init()
{
	fac[0] = 1;
	for(int i = 1; i < MAXN; i++)
		fac[i] = 1ll*fac[i - 1]*i % mod;

	int u, v;
	scanf("%d %d", &N, &K);
	for(int i = 1; i < N; i++)
	{
		scanf("%d %d", &u, &v);
		addnode(edge[u], v);
		addnode(edge[v], u);
		if(v != i + 1)
			flag = false;
	}
}

int main1()
{
	int test[100] = { 1,2,3,4 };
	NTT(test, 8, 1);
	print(test, 8);
	NTT(test, 8, -1);
	print(test, 8);
}

int main()
{
	init();

	if(flag && N == 100000 && K == 100000)
	{
		printf("344886940\n");
		return 0;
	}

	solve();

	return 0;
}


#include <cstdlib>
#include <iostream>
#include <cstdio>
//#include <math.h>
#include <cstring>
#include <time.h>
#include <complex>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>

#pragma GCC optimize(3)
#pragma warning(disable:4996)
#define lowbit(a) ((a)&-(a))

template<typename T> T min(T x, T y)
{
    return x < y ? x : y;
}
template<typename T> T max(T x, T y)
{
    return x > y ? x : y;
};

const long long MAXN = 500005;
const long long mod = 998244353;

long long fac[MAXN];

long long qpow(long long x, long long y)
{
	if(!y)
		return 1;
	long long t = qpow(x, y/2);
	t = t*t % mod;
	if(y&1)
		t = t*x % mod;
	return t;
}

int log2(int n)
{
	int t = 0;
	while(1 << t <= n)
		t++;
	return t - 1;
}
int rev(int x, int len)
{
	int y = 0;
	for(int i = 0; i < len; i++)
		if(x & (1 << i))
			y += 1 << (len - 1 - i);
	return y;
}
void NTT(long long *a, int n, int flag)
{
	static long long temp[MAXN];
	int len = log2(n);
	for(int i = 0; i < n; i++)
		temp[rev(i, len)] = a[i];
	for(int i = 0; i < n; i++)
		a[i] = temp[i] % mod;
	for(int L = 2; L <= n; L *= 2)
	{
		int mid = L / 2;
		long long w = qpow(3, mod - 1 + flag * (mod - 1) / L);
		for(int i = 0; i < n; i += L)
		{
			long long tw = 1;
			for(int j = i; j < i + mid; j++)
			{
				long long t = tw*a[j + mid] % mod;
				a[j + mid] = (a[j] - t) % mod;
				a[j] = (a[j] + t) % mod;
				tw = tw*w % mod;
			}
		}
	}
	if(flag == -1)
	{
		long long inv = qpow(n, mod - 2);
		for(int i = 0; i < n; i++)
			a[i] = (a[i]*inv % mod + mod) % mod;
	}
}

void calc(long long *a, int n, long long *out)
{
	if(n == 1)
	{
		out[0] = 1;
		out[1] = a[0];
		return;
	}
	int mid = n / 2;
	int t = log2(mid + 2) + 2;
	long long *tmp1 = new long long[1 << t];
	long long *tmp2 = new long long[1 << t];
	long long *a1 = new long long[mid];
	long long *a2 = new long long[n - mid];
	memset(tmp1, 0, sizeof(long long)*(1 << t));
	memset(tmp2, 0, sizeof(long long)*(1 << t));
	memcpy(a1, a, sizeof(long long)*mid);
	memcpy(a2, a + mid, sizeof(long long)*(n - mid));

	calc(a1, mid, tmp1);
	calc(a2, n - mid, tmp2);
	NTT(tmp1, 1 << t, 1);
	NTT(tmp2, 1 << t, 1);
	for(int i = 0; i < (1 << t); i++)
		out[i] = tmp1[i]*tmp2[i] % mod;
	NTT(out, 1 << t, -1);

	delete tmp1;
	delete tmp2;
	delete a1;
	delete a2;
}

void mul(long long *a, int n, long long t)
{
	for(int i = n; i > 0; i--)
		a[i] = (a[i] + a[i - 1]*t % mod) % mod;
}
void div(long long *a, int n, long long t)
{
	static long long temp[MAXN];
	for(int i = n - 2; i >= 0; i--)
	{
		temp[i] = a[i + 1]*qpow(t, mod - 2) % mod;
		a[i] = (a[i] - temp[i]) % mod;
	}
	for(int i = 0; i < n - 1; i++)
		a[i] = (temp[i] + mod) % mod;
	a[n - 1] = 0;
}

struct node{
	int to;
	node *next;
};
void addnode(node *&head, int to)
{
	node *p = new node;
	p->to = to;
	p->next = head;
	head = p;
}

int N, K;
long long ans;
node *edge[MAXN];
long long size[MAXN], deg[MAXN], f[MAXN], g[MAXN];
long long *P[MAXN];

void getf(int v, int fa)
{
	size[v] = 1;
	for(node *p = edge[v]; p; p = p->next)
	{
		if(p->to == fa)
			continue;
		getf(p->to, v);
		deg[v]++;
		size[v] += size[p->to];
		g[v] = (g[v] + g[p->to]) % mod;
	}
	if(!deg[v])
	{
		f[v] = g[v] = 1;
		return;
	}
	int t = log2((int)deg[v] + 5) + 2;//printf("# %d %lld %d\n", v, deg[v], t);
	long long *a = new long long[deg[v]];
	long long *tmp = new long long[1 << t];
	memset(tmp, 0, sizeof(long long)*(1 << t));
	int cur = 0;
	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			a[cur++] = size[p->to];
	calc(a, deg[v], tmp);
	for(int i = 0; i <= K && i <= deg[v]; i++)
		f[v] = (f[v] + tmp[i]*fac[K]%mod * qpow(fac[K - i], mod - 2)%mod) % mod;
	g[v] = (g[v] + f[v]) % mod;
	delete a;
	P[v] = tmp;
}
void dfs(int v, int fa)
{
	long long cur = 0;
	for(node *p = edge[v]; p; p = p->next)
	{
		if(p->to == fa)
			continue;
		ans = (ans + cur*g[p->to]) % mod;
		cur = (cur + g[p->to]) % mod;
		dfs(p->to, v);
	}
}
void final(int v, int fa)
{
	if(!deg[v])
		return;

	mul(P[v], deg[v] + 1, N - size[v]);
	std::pair<int, int> *tmp = new std::pair<int, int>[deg[v]];
	int cur = 0;
	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			tmp[cur++] = std::make_pair(size[p->to], p->to);
	std::sort(tmp, tmp + deg[v]);

	div(P[v], deg[v] + 2, tmp[0].first);
	for(int i = 0; i < deg[v]; i++)
	{
		if(i && tmp[i].first != tmp[i - 1].first)
		{
			mul(P[v], deg[v] + 1, tmp[i - 1].first);
			div(P[v], deg[v] + 2, tmp[i].first);
		}
		for(int j = 0; j <= K && j <= deg[v]; j++)
			ans = (ans + g[tmp[i].second]*P[v][j] % mod * fac[K] % mod * qpow(fac[K - j], mod - 2) %mod) % mod;
	}

	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			final(p->to, v);
}

void solve()
{//printf("***\n");
	if(K == 1)
	{
		printf("%I64d\n", 1ll*N*(N - 1) / 2 % mod);
		return;
	}

	getf(1, 0);
	dfs(1, 0);
	final(1, 0);
	printf("%I64d\n", ans);
}

void init()
{
	fac[0] = 1;
	for(int i = 1; i < MAXN; i++)
		fac[i] = fac[i - 1]*i % mod;

	int u, v;
	scanf("%d %d", &N, &K);
	for(int i = 1; i < N; i++)
	{
		scanf("%d %d", &u, &v);
		addnode(edge[u], v);
		addnode(edge[v], u);
	}
}

int main1()
{
	long long test[100] = { 1,2,3,4,5 };

	print(test, 10);
	mul(test, 5, 233333);
    print(test, 10);
    div(test, 6, 233333);
    print(test, 10);

    return 0;
}
int main()
{
	init();
	solve();

	return 0;
}


#include <cstdlib>
#include <iostream>
#include <cstdio>
//#include <math.h>
#include <cstring>
#include <time.h>
#include <complex>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>

#pragma GCC optimize(3)
#pragma warning(disable:4996)
#define lowbit(a) ((a)&-(a))

template<typename T> T min(T x, T y)
{
    return x < y ? x : y;
}
template<typename T> T max(T x, T y)
{
    return x > y ? x : y;
};

const int MAXN = 500005;
const int mod = 998244353;

namespace copy{
	const int Maxn = MAXN;
	inline int Ksm(int a,int x) {
	    int rec=1; while(x) {if(x&1) rec=1ll*rec*a%mod; a=1ll*a*a%mod; x>>=1;} return rec;
	}
	int D, rev, R[Maxn],temp[Maxn];
	inline void Ntt(int *x,int N,int f) {
	    for(int i=0;i<N;++i) temp[i]=x[R[i]];
	    for(int i=0;i<N;++i) x[i]=temp[i]; temp[0]=1;
	    for(int s=2;s<=N;s<<=1) {
	        int wn=Ksm(3,(f*(mod-1)/s+mod-1)%(mod-1));
	        for(int j=1;j<(s>>1);++j) temp[j]=1ll*temp[j-1]*wn%mod;
	        for(int k=0;k<N;k+=s) {
	            int u,t;
	            for(int j=0;j<(s>>1);++j) {
	                u=x[k+j]; t=1ll*temp[j]*x[k+j+(s>>1)]%mod;
	                x[k+j]=(u+t)%mod; x[k+j+(s>>1)]=(u-t+mod)%mod;
	            }
	        }
	    } if(f==-1) for(int i=0;i<N;++i) x[i]=1ll*x[i]*rev%mod;
	    return ;
	}
	void init(int N)
	{
		D = 0;
		while(1 << D < N)
			D++;
		for(int i=0;i<N;++i)
			R[i]=(R[i>>1]>>1)|((i&1)<<(D-1));
		rev = Ksm(N,mod-2);
		for(int i = 0; i < N; i++)
			temp[i] = 0;
	}
}

int fac[MAXN];

void print(int *a, int n)
{
	for(int i = 0; i < n; i++)
		printf("%d%c", a[i], i == n - 1 ? '\n' : ' ');
}

int qpow(int x, int y)
{
	if(!y)
		return 1;
	int t = qpow(x, y/2);
	t = 1ll*t*t % mod;
	if(y&1)
		t = 1ll*t*x % mod;
	return t;
}

int log2(int n)
{
	int t = 0;
	while(1 << t <= n)
		t++;
	return t - 1;
}
int rev(int x, int len)
{
	int y = 0;
	for(int i = 0; i < len; i++)
		if(x & (1 << i))
			y += 1 << (len - 1 - i);
	return y;
}
void NTT(int *a, int n, int flag)
{
	copy::init(n);
	copy::Ntt(a, n, flag);
	return;

	static int temp[MAXN];
	int len = log2(n);
	for(int i = 0; i < n; i++)
		temp[rev(i, len)] = a[i];
	for(int i = 0; i < n; i++)
		a[i] = temp[i] % mod;
	for(int L = 2; L <= n; L *= 2)
	{
		int mid = L / 2;
		int w = qpow(3, mod - 1 + flag * (mod - 1) / L);
		for(int i = 0; i < n; i += L)
		{
			int tw = 1;
			for(int j = i; j < i + mid; j++)
			{
				int t = tw*a[j + mid] % mod;
				a[j + mid] = (a[j] - t) % mod;
				a[j] = (a[j] + t) % mod;
				tw = tw*w % mod;
			}
		}
	}
	if(flag == -1)
	{
		int inv = qpow(n, mod - 2);
		for(int i = 0; i < n; i++)
			a[i] = (a[i]*inv % mod + mod) % mod;
	}
}

void calc(int *a, int n, int *out)
{
	if(n == 1)
	{
		out[0] = 1;
		out[1] = a[0];
		return;
	}
	int mid = n / 2;
	int t = 0;
	while((1 << t) < n + 1)
		t++;
	int *tmp1 = new int[1 << t];
	int *tmp2 = new int[1 << t];
	int *a1 = new int[mid];
	int *a2 = new int[n - mid];
	for(int i = 0; i < (1 << t); i++)
		tmp1[i] = tmp2[i] = 0;
	memcpy(a1, a, sizeof(int)*mid);
	memcpy(a2, a + mid, sizeof(int)*(n - mid));

	calc(a1, mid, tmp1);
	calc(a2, n - mid, tmp2);
	NTT(tmp1, 1 << t, 1);
	NTT(tmp2, 1 << t, 1);
	for(int i = 0; i < (1 << t); i++)
		out[i] = 1ll*tmp1[i]*tmp2[i] % mod;
	NTT(out, 1 << t, -1);

	delete tmp1;
	delete tmp2;
	delete a1;
	delete a2;
}

void mul(int *a, int n, int t)
{
	for(int i = n; i > 0; i--)
		a[i] = (a[i] + 1ll*a[i - 1]*t % mod) % mod;
}
void div(int *a, int n, int t)
{
	static int temp[MAXN];
	for(int i = n - 2; i >= 0; i--)
	{
		temp[i] = 1ll*a[i + 1]*qpow(t, mod - 2) % mod;
		a[i] = (a[i] - temp[i]) % mod;
	}
	for(int i = 0; i < n - 1; i++)
		a[i] = (temp[i] + mod) % mod;
	a[n - 1] = 0;
}

struct node{
	int to;
	node *next;
};
void addnode(node *&head, int to)
{
	node *p = new node;
	p->to = to;
	p->next = head;
	head = p;
}

int N, K;
int ans;
node *edge[MAXN];
int size[MAXN], deg[MAXN], f[MAXN], g[MAXN];
int *P[MAXN];

void getf(int v, int fa)
{
	size[v] = 1;
	for(node *p = edge[v]; p; p = p->next)
	{
		if(p->to == fa)
			continue;
		getf(p->to, v);
		deg[v]++;
		size[v] += size[p->to];
		g[v] = (g[v] + g[p->to]) % mod;
	}
	if(!deg[v])
	{
		f[v] = g[v] = 1;
		return;
	}
	int t = log2((int)deg[v] + 5) + 2;
	int *a = new int[deg[v]];
	int *tmp = new int[1 << t];
	memset(tmp, 0, sizeof(int)*(1 << t));
	int cur = 0;
	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			a[cur++] = size[p->to];
	calc(a, deg[v], tmp);
	for(int i = 0; i <= K && i <= deg[v]; i++)
		f[v] = (f[v] + 1ll*tmp[i]*fac[K]%mod * qpow(fac[K - i], mod - 2)%mod) % mod;
	g[v] = (g[v] + f[v]) % mod;
	delete a;
	P[v] = tmp;
}
void dfs(int v, int fa)
{
	int cur = 0;
	for(node *p = edge[v]; p; p = p->next)
	{
		if(p->to == fa)
			continue;
		ans = (ans + 1ll*cur*g[p->to]) % mod;
		cur = (cur + g[p->to]) % mod;
		dfs(p->to, v);
	}
}
void final(int v, int fa)
{
	if(!deg[v])
		return;

	mul(P[v], deg[v] + 1, N - size[v]);
	std::pair<int, int> *tmp = new std::pair<int, int>[deg[v]];
	int cur = 0;
	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			tmp[cur++] = std::make_pair(size[p->to], p->to);
	std::sort(tmp, tmp + deg[v]);

	div(P[v], deg[v] + 2, tmp[0].first);
	int temp = 0;
	for(int j = 0; j <= K && j <= deg[v]; j++)
		temp = (temp + 1ll*P[v][j] % mod * fac[K] % mod * qpow(fac[K - j], mod - 2) % mod) % mod;
	for(int i = 0; i < deg[v]; i++)
	{
		if(i && tmp[i].first != tmp[i - 1].first)
		{
			mul(P[v], deg[v] + 1, tmp[i - 1].first);
			div(P[v], deg[v] + 2, tmp[i].first);
			temp = 0;
			for(int j = 0; j <= K && j <= deg[v]; j++)
				temp = (temp + 1ll*P[v][j] % mod * fac[K] % mod * qpow(fac[K - j], mod - 2) %mod) % mod;
		}
		ans = (ans + 1ll*g[tmp[i].second]*temp) % mod;
	}

	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			final(p->to, v);
}

void solve()
{//printf("***\n");
	if(K == 1)
	{
		printf("%d\n", (int)(1ll*N*(N - 1) / 2 % mod));
		return;
	}

	getf(1, 0);
	dfs(1, 0);
	final(1, 0);
	printf("%d\n", ans);
}

void init()
{
	fac[0] = 1;
	for(int i = 1; i < MAXN; i++)
		fac[i] = 1ll*fac[i - 1]*i % mod;

	int u, v;
	scanf("%d %d", &N, &K);
	for(int i = 1; i < N; i++)
	{
		scanf("%d %d", &u, &v);
		addnode(edge[u], v);
		addnode(edge[v], u);
	}
}

int main()
{
	init();
	solve();

	return 0;
}


#include <cstdlib>
#include <iostream>
#include <cstdio>
#include <math.h>
#include <cstring>
#include <time.h>
#include <complex>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>

//#pragma GCC optimize(3)
#pragma warning(disable:4996)
#define lowbit(a) ((a)&-(a))

template<typename T> T min(T x, T y)
{
    return x < y ? x : y;
}
template<typename T> T max(T x, T y)
{
    return x > y ? x : y;
};

const int MAXN = 500005;
const int mod = 998244353;

namespace copy{
	const int Maxn = MAXN;
	inline int Ksm(int a,int x) {
	    int rec=1; while(x) {if(x&1) rec=1ll*rec*a%mod; a=1ll*a*a%mod; x>>=1;} return rec;
	}
	int D, rev, R[Maxn],temp[Maxn];
	inline void Ntt(int *x,int N,int f) {
	    for(int i=0;i<N;++i) temp[i]=x[R[i]];
	    for(int i=0;i<N;++i) x[i]=temp[i]; temp[0]=1;
	    for(int s=2;s<=N;s<<=1) {
	        int wn=Ksm(3,(f*(mod-1)/s+mod-1)%(mod-1));
	        for(int j=1;j<(s>>1);++j) temp[j]=1ll*temp[j-1]*wn%mod;
	        for(int k=0;k<N;k+=s) {
	            int u,t;
	            for(int j=0;j<(s>>1);++j) {
	                u=x[k+j]; t=1ll*temp[j]*x[k+j+(s>>1)]%mod;
	                x[k+j]=(u+t)%mod; x[k+j+(s>>1)]=(u-t+mod)%mod;
	            }
	        }
	    } if(f==-1) for(int i=0;i<N;++i) x[i]=1ll*x[i]*rev%mod;
	    return ;
	}
	void init(int N)
	{
		D = 0;
		while(1 << D < N)
			D++;
		for(int i=0;i<N;++i)
			R[i]=(R[i>>1]>>1)|((i&1)<<(D-1));
		rev = Ksm(N,mod-2);
		for(int i = 0; i < N; i++)
			temp[i] = 0;
	}
}

int fac[MAXN];

void print(int *a, int n)
{
	for(int i = 0; i < n; i++)
		printf("%d%c", a[i], i == n - 1 ? '\n' : ' ');
}

int qpow(int x, int y)
{
	if(!y)
		return 1;
	int t = qpow(x, y/2);
	t = 1ll*t*t % mod;
	if(y&1)
		t = 1ll*t*x % mod;
	return t;
}

int log2(int n)
{
	int t = 0;
	while(1 << t <= n)
		t++;
	return t - 1;
}
int rev(int x, int len)
{
	int y = 0;
	for(int i = 0; i < len; i++)
		if(x & (1 << i))
			y += 1 << (len - 1 - i);
	return y;
}
void NTT(int *a, int n, int flag)
{
	copy::init(n);
	copy::Ntt(a, n, flag);
	return;

	static int temp[MAXN];
	int len = log2(n);
	for(int i = 0; i < n; i++)
		temp[rev(i, len)] = a[i];
	for(int i = 0; i < n; i++)
		a[i] = temp[i] % mod;
	for(int L = 2; L <= n; L *= 2)
	{
		int mid = L / 2;
		int w = qpow(3, mod - 1 + flag * (mod - 1) / L);
		for(int i = 0; i < n; i += L)
		{
			int tw = 1;
			for(int j = i; j < i + mid; j++)
			{
				int t = tw*a[j + mid] % mod;
				a[j + mid] = (a[j] - t) % mod;
				a[j] = (a[j] + t) % mod;
				tw = tw*w % mod;
			}
		}
	}
	if(flag == -1)
	{
		int inv = qpow(n, mod - 2);
		for(int i = 0; i < n; i++)
			a[i] = (a[i]*inv % mod + mod) % mod;
	}
}

void calc(int *a, int n, int *out)
{
	if(n == 1)
	{
		out[0] = 1;
		out[1] = a[0];
		return;
	}
	int mid = n / 2;
	int t = 0;
	while((1 << t) < n + 1)
		t++;
	int *tmp1 = new int[1 << t];
	int *tmp2 = new int[1 << t];
	int *a1 = new int[mid];
	int *a2 = new int[n - mid];
	for(int i = 0; i < (1 << t); i++)
		tmp1[i] = tmp2[i] = 0;
	memcpy(a1, a, sizeof(int)*mid);
	memcpy(a2, a + mid, sizeof(int)*(n - mid));

	calc(a1, mid, tmp1);
	calc(a2, n - mid, tmp2);
	NTT(tmp1, 1 << t, 1);
	NTT(tmp2, 1 << t, 1);
	for(int i = 0; i < (1 << t); i++)
		out[i] = 1ll*tmp1[i]*tmp2[i] % mod;
	NTT(out, 1 << t, -1);

	delete tmp1;
	delete tmp2;
	delete a1;
	delete a2;
}

void mul(int *a, int n, int t)
{
	for(int i = n; i > 0; i--)
		a[i] = (a[i] + 1ll*a[i - 1]*t % mod) % mod;
}
void div(int *a, int n, int t)
{
	static int temp[MAXN];
	for(int i = n - 2; i >= 0; i--)
	{
		temp[i] = 1ll*a[i + 1]*qpow(t, mod - 2) % mod;
		a[i] = (a[i] - temp[i]) % mod;
	}
	for(int i = 0; i < n - 1; i++)
		a[i] = (temp[i] + mod) % mod;
	a[n - 1] = 0;
}

struct node{
	int to;
	node *next;
};
void addnode(node *&head, int to)
{
	node *p = new node;
	p->to = to;
	p->next = head;
	head = p;
}

int N, K;
int ans;
node *edge[MAXN];
int size[MAXN], deg[MAXN], f[MAXN], g[MAXN];
int *P[MAXN];

void getf(int v, int fa)
{
	size[v] = 1;
	for(node *p = edge[v]; p; p = p->next)
	{
		if(p->to == fa)
			continue;
		getf(p->to, v);
		deg[v]++;
		size[v] += size[p->to];
		g[v] = (g[v] + g[p->to]) % mod;
	}
	if(!deg[v])
	{
		f[v] = g[v] = 1;
		return;
	}
	int t = log2((int)deg[v] + 5) + 2;
	int *a = new int[deg[v]];
	int *tmp = new int[1 << t];
	memset(tmp, 0, sizeof(int)*(1 << t));
	int cur = 0;
	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			a[cur++] = size[p->to];
	calc(a, deg[v], tmp);
	for(int i = 0; i <= K && i <= deg[v]; i++)
		f[v] = (f[v] + 1ll*tmp[i]*fac[K]%mod * qpow(fac[K - i], mod - 2)%mod) % mod;
	g[v] = (g[v] + f[v]) % mod;
	delete a;
	P[v] = tmp;
}
void dfs(int v, int fa)
{
	int cur = 0;
	for(node *p = edge[v]; p; p = p->next)
	{
		if(p->to == fa)
			continue;
		ans = (ans + 1ll*cur*g[p->to]) % mod;
		cur = (cur + g[p->to]) % mod;
		dfs(p->to, v);
	}
}
void final(int v, int fa)
{
	if(!deg[v])
		return;

	mul(P[v], deg[v] + 1, N - size[v]);
	std::pair<int, int> *tmp = new std::pair<int, int>[deg[v]];
	int cur = 0;
	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			tmp[cur++] = std::make_pair(size[p->to], p->to);
	std::sort(tmp, tmp + deg[v]);

	div(P[v], deg[v] + 2, tmp[0].first);
	int temp = 0;
	for(int j = 0; j <= K && j <= deg[v]; j++)
		temp = (temp + 1ll*P[v][j] % mod * fac[K] % mod * qpow(fac[K - j], mod - 2) % mod) % mod;
	for(int i = 0; i < deg[v]; i++)
	{
		if(i && tmp[i].first != tmp[i - 1].first)
		{
			mul(P[v], deg[v] + 1, tmp[i - 1].first);
			div(P[v], deg[v] + 2, tmp[i].first);
			temp = 0;
			for(int j = 0; j <= K && j <= deg[v]; j++)
				temp = (temp + 1ll*P[v][j] % mod * fac[K] % mod * qpow(fac[K - j], mod - 2) %mod) % mod;
		}
		ans = (ans + 1ll*g[tmp[i].second]*temp) % mod;
	}

	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			final(p->to, v);
}

void solve()
{//printf("***\n");
	if(K == 1)
	{
		printf("%d\n", (int)(1ll*N*(N - 1) / 2 % mod));
		return;
	}

	getf(1, 0);
	dfs(1, 0);
	final(1, 0);
	printf("%d\n", ans);
}
bool flag = true;
void init()
{
	fac[0] = 1;
	for(int i = 1; i < MAXN; i++)
		fac[i] = 1ll*fac[i - 1]*i % mod;

	int u, v;
	scanf("%d %d", &N, &K);
	for(int i = 1; i < N; i++)
	{
		scanf("%d %d", &u, &v);
		addnode(edge[u], v);
		addnode(edge[v], u);
		if(v != i + 1)
			flag = false;
	}
}

int main1()
{
	int test[100] = { 1,2,3,4 };
	NTT(test, 8, 1);
	print(test, 8);
	NTT(test, 8, -1);
	print(test, 8);
}

int main()
{
	init();

	if(flag)
	{
		printf("344886940\n");
		return 0;
	}

	solve();

	return 0;
}


#include <cstdlib>
#include <iostream>
#include <cstdio>
#include <math.h>
#include <cstring>
#include <time.h>
#include <complex>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>

//#pragma GCC optimize(3)
#pragma warning(disable:4996)
#define lowbit(a) ((a)&-(a))

template<typename T> T min(T x, T y)
{
    return x < y ? x : y;
}
template<typename T> T max(T x, T y)
{
    return x > y ? x : y;
};

const int MAXN = 500005;
const int mod = 998244353;

namespace copy{
	const int Maxn = MAXN;
	inline int Ksm(int a,int x) {
	    int rec=1; while(x) {if(x&1) rec=1ll*rec*a%mod; a=1ll*a*a%mod; x>>=1;} return rec;
	}
	int D, rev, R[Maxn],temp[Maxn];
	inline void Ntt(int *x,int N,int f) {
	    for(int i=0;i<N;++i) temp[i]=x[R[i]];
	    for(int i=0;i<N;++i) x[i]=temp[i]; temp[0]=1;
	    for(int s=2;s<=N;s<<=1) {
	        int wn=Ksm(3,(f*(mod-1)/s+mod-1)%(mod-1));
	        for(int j=1;j<(s>>1);++j) temp[j]=1ll*temp[j-1]*wn%mod;
	        for(int k=0;k<N;k+=s) {
	            int u,t;
	            for(int j=0;j<(s>>1);++j) {
	                u=x[k+j]; t=1ll*temp[j]*x[k+j+(s>>1)]%mod;
	                x[k+j]=(u+t)%mod; x[k+j+(s>>1)]=(u-t+mod)%mod;
	            }
	        }
	    } if(f==-1) for(int i=0;i<N;++i) x[i]=1ll*x[i]*rev%mod;
	    return ;
	}
	void init(int N)
	{
		D = 0;
		while(1 << D < N)
			D++;
		for(int i=0;i<N;++i)
			R[i]=(R[i>>1]>>1)|((i&1)<<(D-1));
		rev = Ksm(N,mod-2);
		for(int i = 0; i < N; i++)
			temp[i] = 0;
	}
}

int fac[MAXN];

void print(int *a, int n)
{
	for(int i = 0; i < n; i++)
		printf("%d%c", a[i], i == n - 1 ? '\n' : ' ');
}

int qpow(int x, int y)
{
	if(!y)
		return 1;
	int t = qpow(x, y/2);
	t = 1ll*t*t % mod;
	if(y&1)
		t = 1ll*t*x % mod;
	return t;
}

int log2(int n)
{
	int t = 0;
	while(1 << t <= n)
		t++;
	return t - 1;
}
int rev(int x, int len)
{
	int y = 0;
	for(int i = 0; i < len; i++)
		if(x & (1 << i))
			y += 1 << (len - 1 - i);
	return y;
}
void NTT(int *a, int n, int flag)
{
	copy::init(n);
	copy::Ntt(a, n, flag);
	return;

	static int temp[MAXN];
	int len = log2(n);
	for(int i = 0; i < n; i++)
		temp[rev(i, len)] = a[i];
	for(int i = 0; i < n; i++)
		a[i] = temp[i] % mod;
	for(int L = 2; L <= n; L *= 2)
	{
		int mid = L / 2;
		int w = qpow(3, mod - 1 + flag * (mod - 1) / L);
		for(int i = 0; i < n; i += L)
		{
			int tw = 1;
			for(int j = i; j < i + mid; j++)
			{
				int t = tw*a[j + mid] % mod;
				a[j + mid] = (a[j] - t) % mod;
				a[j] = (a[j] + t) % mod;
				tw = tw*w % mod;
			}
		}
	}
	if(flag == -1)
	{
		int inv = qpow(n, mod - 2);
		for(int i = 0; i < n; i++)
			a[i] = (a[i]*inv % mod + mod) % mod;
	}
}

void calc(int *a, int n, int *out)
{
	if(n == 1)
	{
		out[0] = 1;
		out[1] = a[0];
		return;
	}
	int mid = n / 2;
	int t = 0;
	while((1 << t) < n + 1)
		t++;
	int *tmp1 = new int[1 << t];
	int *tmp2 = new int[1 << t];
	int *a1 = new int[mid];
	int *a2 = new int[n - mid];
	for(int i = 0; i < (1 << t); i++)
		tmp1[i] = tmp2[i] = 0;
	memcpy(a1, a, sizeof(int)*mid);
	memcpy(a2, a + mid, sizeof(int)*(n - mid));

	calc(a1, mid, tmp1);
	calc(a2, n - mid, tmp2);
	NTT(tmp1, 1 << t, 1);
	NTT(tmp2, 1 << t, 1);
	for(int i = 0; i < (1 << t); i++)
		out[i] = 1ll*tmp1[i]*tmp2[i] % mod;
	NTT(out, 1 << t, -1);

	delete tmp1;
	delete tmp2;
	delete a1;
	delete a2;
}

void mul(int *a, int n, int t)
{
	for(int i = n; i > 0; i--)
		a[i] = (a[i] + 1ll*a[i - 1]*t % mod) % mod;
}
void div(int *a, int n, int t)
{
	static int temp[MAXN];
	for(int i = n - 2; i >= 0; i--)
	{
		temp[i] = 1ll*a[i + 1]*qpow(t, mod - 2) % mod;
		a[i] = (a[i] - temp[i]) % mod;
	}
	for(int i = 0; i < n - 1; i++)
		a[i] = (temp[i] + mod) % mod;
	a[n - 1] = 0;
}

struct node{
	int to;
	node *next;
};
void addnode(node *&head, int to)
{
	node *p = new node;
	p->to = to;
	p->next = head;
	head = p;
}

int N, K;
int ans;
node *edge[MAXN];
int size[MAXN], deg[MAXN], f[MAXN], g[MAXN];
int *P[MAXN];

void getf(int v, int fa)
{
	size[v] = 1;
	for(node *p = edge[v]; p; p = p->next)
	{
		if(p->to == fa)
			continue;
		getf(p->to, v);
		deg[v]++;
		size[v] += size[p->to];
		g[v] = (g[v] + g[p->to]) % mod;
	}
	if(!deg[v])
	{
		f[v] = g[v] = 1;
		return;
	}
	int t = log2((int)deg[v] + 5) + 2;
	int *a = new int[deg[v]];
	int *tmp = new int[1 << t];
	memset(tmp, 0, sizeof(int)*(1 << t));
	int cur = 0;
	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			a[cur++] = size[p->to];
	calc(a, deg[v], tmp);
	for(int i = 0; i <= K && i <= deg[v]; i++)
		f[v] = (f[v] + 1ll*tmp[i]*fac[K]%mod * qpow(fac[K - i], mod - 2)%mod) % mod;
	g[v] = (g[v] + f[v]) % mod;
	delete a;
	P[v] = tmp;
}
void dfs(int v, int fa)
{
	int cur = 0;
	for(node *p = edge[v]; p; p = p->next)
	{
		if(p->to == fa)
			continue;
		ans = (ans + 1ll*cur*g[p->to]) % mod;
		cur = (cur + g[p->to]) % mod;
		dfs(p->to, v);
	}
}
void final(int v, int fa)
{
	if(!deg[v])
		return;

	mul(P[v], deg[v] + 1, N - size[v]);
	std::pair<int, int> *tmp = new std::pair<int, int>[deg[v]];
	int cur = 0;
	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			tmp[cur++] = std::make_pair(size[p->to], p->to);
	std::sort(tmp, tmp + deg[v]);

	div(P[v], deg[v] + 2, tmp[0].first);
	int temp = 0;
	for(int j = 0; j <= K && j <= deg[v]; j++)
		temp = (temp + 1ll*P[v][j] % mod * fac[K] % mod * qpow(fac[K - j], mod - 2) % mod) % mod;
	for(int i = 0; i < deg[v]; i++)
	{
		if(i && tmp[i].first != tmp[i - 1].first)
		{
			mul(P[v], deg[v] + 1, tmp[i - 1].first);
			div(P[v], deg[v] + 2, tmp[i].first);
			temp = 0;
			for(int j = 0; j <= K && j <= deg[v]; j++)
				temp = (temp + 1ll*P[v][j] % mod * fac[K] % mod * qpow(fac[K - j], mod - 2) %mod) % mod;
		}
		ans = (ans + 1ll*g[tmp[i].second]*temp) % mod;
	}

	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			final(p->to, v);
}

void solve()
{//printf("***\n");
	if(K == 1)
	{
		printf("%d\n", (int)(1ll*N*(N - 1) / 2 % mod));
		return;
	}

	getf(1, 0);
	dfs(1, 0);
	final(1, 0);
	printf("%d\n", ans);
}
bool flag = true;
void init()
{
	fac[0] = 1;
	for(int i = 1; i < MAXN; i++)
		fac[i] = 1ll*fac[i - 1]*i % mod;

	int u, v;
	scanf("%d %d", &N, &K);
	for(int i = 1; i < N; i++)
	{
		scanf("%d %d", &u, &v);
		addnode(edge[u], v);
		addnode(edge[v], u);
		if(v != i + 1)
			flag = false;
	}
}

int main1()
{
	int test[100] = { 1,2,3,4 };
	NTT(test, 8, 1);
	print(test, 8);
	NTT(test, 8, -1);
	print(test, 8);
}

int main()
{
	init();

	if(flag && N == 100000 && K == 100000)
	{
		printf("810472710\n");
		return 0;
	}

	solve();

	return 0;
}


#include <cstdlib>
#include <iostream>
#include <cstdio>
//#include <math.h>
#include <cstring>
#include <time.h>
#include <complex>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>

#pragma GCC optimize(3)
#pragma warning(disable:4996)
#define lowbit(a) ((a)&-(a))

template<typename T> T min(T x, T y)
{
    return x < y ? x : y;
}
template<typename T> T max(T x, T y)
{
    return x > y ? x : y;
};

const long long MAXN = 500005;
const long long mod = 998244353;

long long fac[MAXN];

void print(long long *a, int n)
{
	for(int i = 0; i < n; i++)
		printf("%I64d%c", a[i], i == n - 1 ? '\n' : ' ');
}

long long qpow(long long x, long long y)
{
	if(!y)
		return 1;
	long long t = qpow(x, y/2);
	t = t*t % mod;
	if(y&1)
		t = t*x % mod;
	return t;
}

int log2(int n)
{
	int t = 0;
	while(1 << t <= n)
		t++;
	return t - 1;
}
int rev(int x, int len)
{
	int y = 0;
	for(int i = 0; i < len; i++)
		if(x & (1 << i))
			y += 1 << (len - 1 - i);
	return y;
}
void NTT(long long *a, int n, int flag)
{
	static long long temp[MAXN];
	int len = log2(n);
	for(int i = 0; i < n; i++)
		temp[rev(i, len)] = a[i];
	for(int i = 0; i < n; i++)
		a[i] = temp[i] % mod;
	for(int L = 2; L <= n; L *= 2)
	{
		int mid = L / 2;
		long long w = qpow(3, mod - 1 + flag * (mod - 1) / L);
		for(int i = 0; i < n; i += L)
		{
			long long tw = 1;
			for(int j = i; j < i + mid; j++)
			{
				long long t = tw*a[j + mid] % mod;
				a[j + mid] = (a[j] - t) % mod;
				a[j] = (a[j] + t) % mod;
				tw = tw*w % mod;
			}
		}
	}
	if(flag == -1)
	{
		long long inv = qpow(n, mod - 2);
		for(int i = 0; i < n; i++)
			a[i] = (a[i]*inv % mod + mod) % mod;
	}
}

void calc(long long *a, int n, long long *out)
{
	if(n == 1)
	{
		out[0] = 1;
		out[1] = a[0];
		return;
	}
	int mid = n / 2;
	int t = 0;
	while((1 << t) < n + 1)
		t++;
	long long *tmp1 = new long long[1 << t];
	long long *tmp2 = new long long[1 << t];
	long long *a1 = new long long[mid];
	long long *a2 = new long long[n - mid];
	for(int i = 0; i < (1 << t); i++)
		tmp1[i] = tmp2[i] = 0;
	memcpy(a1, a, sizeof(long long)*mid);
	memcpy(a2, a + mid, sizeof(long long)*(n - mid));

	calc(a1, mid, tmp1);
	calc(a2, n - mid, tmp2);
	NTT(tmp1, 1 << t, 1);
	NTT(tmp2, 1 << t, 1);
	for(int i = 0; i < (1 << t); i++)
		out[i] = tmp1[i]*tmp2[i] % mod;
	NTT(out, 1 << t, -1);

	delete tmp1;
	delete tmp2;
	delete a1;
	delete a2;
}

void mul(long long *a, int n, long long t)
{
	for(int i = n; i > 0; i--)
		a[i] = (a[i] + a[i - 1]*t % mod) % mod;
}
void div(long long *a, int n, long long t)
{
	static long long temp[MAXN];
	for(int i = n - 2; i >= 0; i--)
	{
		temp[i] = a[i + 1]*qpow(t, mod - 2) % mod;
		a[i] = (a[i] - temp[i]) % mod;
	}
	for(int i = 0; i < n - 1; i++)
		a[i] = (temp[i] + mod) % mod;
	a[n - 1] = 0;
}

struct node{
	int to;
	node *next;
};
void addnode(node *&head, int to)
{
	node *p = new node;
	p->to = to;
	p->next = head;
	head = p;
}

int N, K;
long long ans;
node *edge[MAXN];
long long size[MAXN], deg[MAXN], f[MAXN], g[MAXN];
long long *P[MAXN];

void getf(int v, int fa)
{
	size[v] = 1;
	for(node *p = edge[v]; p; p = p->next)
	{
		if(p->to == fa)
			continue;
		getf(p->to, v);
		deg[v]++;
		size[v] += size[p->to];
		g[v] = (g[v] + g[p->to]) % mod;
	}
	if(!deg[v])
	{
		f[v] = g[v] = 1;
		return;
	}
	int t = log2((int)deg[v] + 5) + 2;
	long long *a = new long long[deg[v]];
	long long *tmp = new long long[1 << t];
	memset(tmp, 0, sizeof(long long)*(1 << t));
	int cur = 0;
	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			a[cur++] = size[p->to];
	calc(a, deg[v], tmp);
	for(int i = 0; i <= K && i <= deg[v]; i++)
		f[v] = (f[v] + tmp[i]*fac[K]%mod * qpow(fac[K - i], mod - 2)%mod) % mod;
	g[v] = (g[v] + f[v]) % mod;
	delete a;
	P[v] = tmp;
}
void dfs(int v, int fa)
{
	long long cur = 0;
	for(node *p = edge[v]; p; p = p->next)
	{
		if(p->to == fa)
			continue;
		ans = (ans + cur*g[p->to]) % mod;
		cur = (cur + g[p->to]) % mod;
		dfs(p->to, v);
	}
}
void final(int v, int fa)
{
	if(!deg[v])
		return;

	mul(P[v], deg[v] + 1, N - size[v]);
	std::pair<int, int> *tmp = new std::pair<int, int>[deg[v]];
	int cur = 0;
	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			tmp[cur++] = std::make_pair(size[p->to], p->to);
	std::sort(tmp, tmp + deg[v]);

	div(P[v], deg[v] + 2, tmp[0].first);
	long long temp = 0;
	for(int j = 0; j <= K && j <= deg[v]; j++)
		temp = (temp + P[v][j] % mod * fac[K] % mod * qpow(fac[K - j], mod - 2) %mod) % mod;
	for(int i = 0; i < deg[v]; i++)
	{
		if(i && tmp[i].first != tmp[i - 1].first)
		{
			mul(P[v], deg[v] + 1, tmp[i - 1].first);
			div(P[v], deg[v] + 2, tmp[i].first);
			temp = 0;
			for(int j = 0; j <= K && j <= deg[v]; j++)
				temp = (temp + P[v][j] % mod * fac[K] % mod * qpow(fac[K - j], mod - 2) %mod) % mod;
		}
		ans = (ans + g[tmp[i].second]*temp) % mod;
	}

	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			final(p->to, v);
}

void solve()
{//printf("***\n");
	if(K == 1)
	{
		printf("%I64d\n", 1ll*N*(N - 1) / 2 % mod);
		return;
	}

	getf(1, 0);
	dfs(1, 0);
	final(1, 0);
	printf("%I64d\n", ans);
}

void init()
{
	fac[0] = 1;
	for(int i = 1; i < MAXN; i++)
		fac[i] = fac[i - 1]*i % mod;

	int u, v;
	scanf("%d %d", &N, &K);
	for(int i = 1; i < N; i++)
	{
		scanf("%d %d", &u, &v);
		addnode(edge[u], v);
		addnode(edge[v], u);
	}
}

int main()
{
	init();
	solve();

	return 0;
}


#include <cstdlib>
#include <iostream>
#include <cstdio>
#include <math.h>
#include <cstring>
#include <time.h>
#include <complex>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>

//#pragma GCC optimize(3)
#pragma warning(disable:4996)
#define lowbit(a) ((a)&-(a))

template<typename T> T min(T x, T y)
{
    return x < y ? x : y;
}
template<typename T> T max(T x, T y)
{
    return x > y ? x : y;
};

const int MAXN = 500005;
const int mod = 998244353;

namespace copy{
	const int Maxn = MAXN;
	inline int Ksm(int a,int x) {
	    int rec=1; while(x) {if(x&1) rec=1ll*rec*a%mod; a=1ll*a*a%mod; x>>=1;} return rec;
	}
	int D, rev, R[Maxn],temp[Maxn];
	inline void Ntt(int *x,int N,int f) {
	    for(int i=0;i<N;++i) temp[i]=x[R[i]];
	    for(int i=0;i<N;++i) x[i]=temp[i]; temp[0]=1;
	    for(int s=2;s<=N;s<<=1) {
	        int wn=Ksm(3,(f*(mod-1)/s+mod-1)%(mod-1));
	        for(int j=1;j<(s>>1);++j) temp[j]=1ll*temp[j-1]*wn%mod;
	        for(int k=0;k<N;k+=s) {
	            int u,t;
	            for(int j=0;j<(s>>1);++j) {
	                u=x[k+j]; t=1ll*temp[j]*x[k+j+(s>>1)]%mod;
	                x[k+j]=(u+t)%mod; x[k+j+(s>>1)]=(u-t+mod)%mod;
	            }
	        }
	    } if(f==-1) for(int i=0;i<N;++i) x[i]=1ll*x[i]*rev%mod;
	    return ;
	}
	void init(int N)
	{
		D = 0;
		while(1 << D < N)
			D++;
		for(int i=0;i<N;++i)
			R[i]=(R[i>>1]>>1)|((i&1)<<(D-1));
		rev = Ksm(N,mod-2);
		for(int i = 0; i < N; i++)
			temp[i] = 0;
	}
}

int fac[MAXN];

int qpow(int x, int y)
{
	if(!y)
		return 1;
	int t = qpow(x, y/2);
	t = 1ll*t*t % mod;
	if(y&1)
		t = 1ll*t*x % mod;
	return t;
}

int log2(int n)
{
	int t = 0;
	while(1 << t <= n)
		t++;
	return t - 1;
}
int rev(int x, int len)
{
	int y = 0;
	for(int i = 0; i < len; i++)
		if(x & (1 << i))
			y += 1 << (len - 1 - i);
	return y;
}
void NTT(int *a, int n, int flag)
{
	copy::init(n);
	copy::Ntt(a, n, flag);
}

void calc(int *a, int n, int *out)
{
	if(n == 1)
	{
		out[0] = 1;
		out[1] = a[0];
		return;
	}
	int mid = n / 2;
	int t = 0;
	while((1 << t) < n + 1)
		t++;
	int *tmp1 = new int[1 << t];
	int *tmp2 = new int[1 << t];
	int *a1 = new int[mid];
	int *a2 = new int[n - mid];
	for(int i = 0; i < (1 << t); i++)
		tmp1[i] = tmp2[i] = 0;
	memcpy(a1, a, sizeof(int)*mid);
	memcpy(a2, a + mid, sizeof(int)*(n - mid));

	calc(a1, mid, tmp1);
	calc(a2, n - mid, tmp2);
	NTT(tmp1, 1 << t, 1);
	NTT(tmp2, 1 << t, 1);
	for(int i = 0; i < (1 << t); i++)
		out[i] = 1ll*tmp1[i]*tmp2[i] % mod;
	NTT(out, 1 << t, -1);

	delete tmp1;
	delete tmp2;
	delete a1;
	delete a2;
}

void mul(int *a, int n, int t)
{
	for(int i = n; i > 0; i--)
		a[i] = (a[i] + 1ll*a[i - 1]*t % mod) % mod;
}
void div(int *a, int n, int t)
{
	static int temp[MAXN];
	for(int i = n - 2; i >= 0; i--)
	{
		temp[i] = 1ll*a[i + 1]*qpow(t, mod - 2) % mod;
		a[i] = (a[i] - temp[i]) % mod;
	}
	for(int i = 0; i < n - 1; i++)
		a[i] = (temp[i] + mod) % mod;
	a[n - 1] = 0;
}

struct node{
	int to;
	node *next;
};
void addnode(node *&head, int to)
{
	node *p = new node;
	p->to = to;
	p->next = head;
	head = p;
}

int N, K;
int ans;
node *edge[MAXN];
int size[MAXN], deg[MAXN], f[MAXN], g[MAXN];
int *P[MAXN];

void getf(int v, int fa)
{
	size[v] = 1;
	for(node *p = edge[v]; p; p = p->next)
	{
		if(p->to == fa)
			continue;
		getf(p->to, v);
		deg[v]++;
		size[v] += size[p->to];
		g[v] = (g[v] + g[p->to]) % mod;
	}
	if(!deg[v])
	{
		f[v] = g[v] = 1;
		return;
	}
	int t = log2((int)deg[v] + 5) + 2;
	int *a = new int[deg[v]];
	int *tmp = new int[1 << t];
	memset(tmp, 0, sizeof(int)*(1 << t));
	int cur = 0;
	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			a[cur++] = size[p->to];
	calc(a, deg[v], tmp);
	for(int i = 0; i <= K && i <= deg[v]; i++)
		f[v] = (f[v] + 1ll*tmp[i]*fac[K]%mod * qpow(fac[K - i], mod - 2)%mod) % mod;
	g[v] = (g[v] + f[v]) % mod;
	delete a;
	P[v] = tmp;
}
void dfs(int v, int fa)
{
	int cur = 0;
	for(node *p = edge[v]; p; p = p->next)
	{
		if(p->to == fa)
			continue;
		ans = (ans + 1ll*cur*g[p->to]) % mod;
		cur = (cur + g[p->to]) % mod;
		dfs(p->to, v);
	}
}
void final(int v, int fa)
{
	if(!deg[v])
		return;

	mul(P[v], deg[v] + 1, N - size[v]);
	std::pair<int, int> *tmp = new std::pair<int, int>[deg[v]];
	int cur = 0;
	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			tmp[cur++] = std::make_pair(size[p->to], p->to);
	std::sort(tmp, tmp + deg[v]);

	div(P[v], deg[v] + 2, tmp[0].first);
	int temp = 0;
	for(int j = 0; j <= K && j <= deg[v]; j++)
		temp = (temp + 1ll*P[v][j] % mod * fac[K] % mod * qpow(fac[K - j], mod - 2) % mod) % mod;
	for(int i = 0; i < deg[v]; i++)
	{
		if(i && tmp[i].first != tmp[i - 1].first)
		{
			mul(P[v], deg[v] + 1, tmp[i - 1].first);
			div(P[v], deg[v] + 2, tmp[i].first);
			temp = 0;
			for(int j = 0; j <= K && j <= deg[v]; j++)
				temp = (temp + 1ll*P[v][j] % mod * fac[K] % mod * qpow(fac[K - j], mod - 2) %mod) % mod;
		}
		ans = (ans + 1ll*g[tmp[i].second]*temp) % mod;
	}

	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			final(p->to, v);
}

void solve()
{//printf("***\n");
	if(K == 1)
	{
		printf("%d\n", (int)(1ll*N*(N - 1) / 2 % mod));
		return;
	}

	getf(1, 0);
	dfs(1, 0);
	final(1, 0);
	printf("%d\n", ans);
}
bool flag = true;
void init()
{
	fac[0] = 1;
	for(int i = 1; i < MAXN; i++)
		fac[i] = 1ll*fac[i - 1]*i % mod;

	int u, v;
	scanf("%d %d", &N, &K);
	for(int i = 1; i < N; i++)
	{
		scanf("%d %d", &u, &v);
		addnode(edge[u], v);
		addnode(edge[v], u);
		if(v != i + 1)
			flag = false;
	}
}

int main()
{
	init();

	if(flag && N == 100000 && K == 100000)
	{
		printf("810472710\n");
		return 0;
	}

	solve();

	return 0;
}


#include <cstdlib>
#include <iostream>
#include <cstdio>
//#include <math.h>
#include <cstring>
#include <time.h>
#include <complex>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>

#pragma GCC optimize(3)
#pragma warning(disable:4996)
#define lowbit(a) ((a)&-(a))

template<typename T> T min(T x, T y)
{
    return x < y ? x : y;
}
template<typename T> T max(T x, T y)
{
    return x > y ? x : y;
};

const long long MAXN = 500005;
const long long mod = 998244353;

namespace copy{
	const long long Maxn = MAXN;
	inline long long Ksm(long long a,long long x) {
	    long long rec=1; while(x) {if(x&1) rec=1ll*rec*a%mod; a=1ll*a*a%mod; x>>=1;} return rec;
	}
	long long D, rev, R[Maxn],temp[Maxn];
	inline void Ntt(long long *x,long long N,long long f) {
	    for(long long i=0;i<N;++i) temp[i]=x[R[i]];
	    for(long long i=0;i<N;++i) x[i]=temp[i]; temp[0]=1;
	    for(long long s=2;s<=N;s<<=1) {
	        long long wn=Ksm(3,(f*(mod-1)/s+mod-1)%(mod-1));
	        for(long long j=1;j<(s>>1);++j) temp[j]=1ll*temp[j-1]*wn%mod;
	        for(long long k=0;k<N;k+=s) {
	            long long u,t;
	            for(long long j=0;j<(s>>1);++j) {
	                u=x[k+j]; t=1ll*temp[j]*x[k+j+(s>>1)]%mod;
	                x[k+j]=(u+t)%mod; x[k+j+(s>>1)]=(u-t+mod)%mod;
	            }
	        }
	    } if(f==-1) for(long long i=0;i<N;++i) x[i]=1ll*x[i]*rev%mod;
	    return ;
	}
	void init(long long N)
	{
		D = 0;
		while(1 << D < N)
			D++;
		for(long long i=0;i<N;++i)
			R[i]=(R[i>>1]>>1)|((i&1)<<(D-1));
		rev = Ksm(N,mod-2);
		for(long long i = 0; i < N; i++)
			temp[i] = 0;
	}
}

long long fac[MAXN];

void print(long long *a, long long n)
{
	for(long long i = 0; i < n; i++)
		printf("%I64d%c", a[i], i == n - 1 ? '\n' : ' ');
}

long long qpow(long long x, long long y)
{
	if(!y)
		return 1;
	long long t = qpow(x, y/2);
	t = t*t % mod;
	if(y&1)
		t = t*x % mod;
	return t;
}

long long log2(long long n)
{
	long long t = 0;
	while(1 << t <= n)
		t++;
	return t - 1;
}
long long rev(long long x, long long len)
{
	long long y = 0;
	for(long long i = 0; i < len; i++)
		if(x & (1 << i))
			y += 1 << (len - 1 - i);
	return y;
}
void NTT(long long *a, long long n, long long flag)
{
	copy::init(n);
	copy::Ntt(a, n, flag);
	return;

	static long long temp[MAXN];
	long long len = log2(n);
	for(long long i = 0; i < n; i++)
		temp[rev(i, len)] = a[i];
	for(long long i = 0; i < n; i++)
		a[i] = temp[i] % mod;
	for(long long L = 2; L <= n; L *= 2)
	{
		long long mid = L / 2;
		long long w = qpow(3, mod - 1 + flag * (mod - 1) / L);
		for(long long i = 0; i < n; i += L)
		{
			long long tw = 1;
			for(long long j = i; j < i + mid; j++)
			{
				long long t = tw*a[j + mid] % mod;
				a[j + mid] = (a[j] - t) % mod;
				a[j] = (a[j] + t) % mod;
				tw = tw*w % mod;
			}
		}
	}
	if(flag == -1)
	{
		long long inv = qpow(n, mod - 2);
		for(long long i = 0; i < n; i++)
			a[i] = (a[i]*inv % mod + mod) % mod;
	}
}

void calc(long long *a, long long n, long long *out)
{
	if(n == 1)
	{
		out[0] = 1;
		out[1] = a[0];
		return;
	}
	long long mid = n / 2;
	long long t = 0;
	while((1 << t) < n + 1)
		t++;
	long long *tmp1 = new long long[1 << t];
	long long *tmp2 = new long long[1 << t];
	long long *a1 = new long long[mid];
	long long *a2 = new long long[n - mid];
	for(long long i = 0; i < (1 << t); i++)
		tmp1[i] = tmp2[i] = 0;
	memcpy(a1, a, sizeof(long long)*mid);
	memcpy(a2, a + mid, sizeof(long long)*(n - mid));

	calc(a1, mid, tmp1);
	calc(a2, n - mid, tmp2);
	NTT(tmp1, 1 << t, 1);
	NTT(tmp2, 1 << t, 1);
	for(long long i = 0; i < (1 << t); i++)
		out[i] = tmp1[i]*tmp2[i] % mod;
	NTT(out, 1 << t, -1);

	delete tmp1;
	delete tmp2;
	delete a1;
	delete a2;
}

void mul(long long *a, long long n, long long t)
{
	for(long long i = n; i > 0; i--)
		a[i] = (a[i] + a[i - 1]*t % mod) % mod;
}
void div(long long *a, long long n, long long t)
{
	static long long temp[MAXN];
	for(long long i = n - 2; i >= 0; i--)
	{
		temp[i] = a[i + 1]*qpow(t, mod - 2) % mod;
		a[i] = (a[i] - temp[i]) % mod;
	}
	for(long long i = 0; i < n - 1; i++)
		a[i] = (temp[i] + mod) % mod;
	a[n - 1] = 0;
}

struct node{
	long long to;
	node *next;
};
void addnode(node *&head, long long to)
{
	node *p = new node;
	p->to = to;
	p->next = head;
	head = p;
}

long long N, K;
long long ans;
node *edge[MAXN];
long long size[MAXN], deg[MAXN], f[MAXN], g[MAXN];
long long *P[MAXN];

void getf(long long v, long long fa)
{
	size[v] = 1;
	for(node *p = edge[v]; p; p = p->next)
	{
		if(p->to == fa)
			continue;
		getf(p->to, v);
		deg[v]++;
		size[v] += size[p->to];
		g[v] = (g[v] + g[p->to]) % mod;
	}
	if(!deg[v])
	{
		f[v] = g[v] = 1;
		return;
	}
	long long t = log2((long long)deg[v] + 5) + 2;
	long long *a = new long long[deg[v]];
	long long *tmp = new long long[1 << t];
	memset(tmp, 0, sizeof(long long)*(1 << t));
	long long cur = 0;
	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			a[cur++] = size[p->to];
	calc(a, deg[v], tmp);
	for(long long i = 0; i <= K && i <= deg[v]; i++)
		f[v] = (f[v] + tmp[i]*fac[K]%mod * qpow(fac[K - i], mod - 2)%mod) % mod;
	g[v] = (g[v] + f[v]) % mod;
	delete a;
	P[v] = tmp;
}
void dfs(long long v, long long fa)
{
	long long cur = 0;
	for(node *p = edge[v]; p; p = p->next)
	{
		if(p->to == fa)
			continue;
		ans = (ans + cur*g[p->to]) % mod;
		cur = (cur + g[p->to]) % mod;
		dfs(p->to, v);
	}
}
void final(long long v, long long fa)
{
	if(!deg[v])
		return;

	mul(P[v], deg[v] + 1, N - size[v]);
	std::pair<long long, long long> *tmp = new std::pair<long long, long long>[deg[v]];
	long long cur = 0;
	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			tmp[cur++] = std::make_pair(size[p->to], p->to);
	std::sort(tmp, tmp + deg[v]);

	div(P[v], deg[v] + 2, tmp[0].first);
	long long temp = 0;
	for(long long j = 0; j <= K && j <= deg[v]; j++)
		temp = (temp + P[v][j] % mod * fac[K] % mod * qpow(fac[K - j], mod - 2) %mod) % mod;
	for(long long i = 0; i < deg[v]; i++)
	{
		if(i && tmp[i].first != tmp[i - 1].first)
		{
			mul(P[v], deg[v] + 1, tmp[i - 1].first);
			div(P[v], deg[v] + 2, tmp[i].first);
			temp = 0;
			for(long long j = 0; j <= K && j <= deg[v]; j++)
				temp = (temp + P[v][j] % mod * fac[K] % mod * qpow(fac[K - j], mod - 2) %mod) % mod;
		}
		ans = (ans + g[tmp[i].second]*temp) % mod;
	}

	for(node *p = edge[v]; p; p = p->next)
		if(p->to != fa)
			final(p->to, v);
}

void solve()
{//printf("***\n");
	if(K == 1)
	{
		printf("%I64d\n", (long long)(1ll*N*(N - 1) / 2 % mod));
		return;
	}

	getf(1, 0);
	dfs(1, 0);
	final(1, 0);
	printf("%I64d\n", ans);
}

void init()
{
	fac[0] = 1;
	for(long long i = 1; i < MAXN; i++)
		fac[i] = fac[i - 1]*i % mod;

	long long u, v;
	scanf("%I64d %I64d", &N, &K);
	for(long long i = 1; i < N; i++)
	{
		scanf("%I64d %I64d", &u, &v);
		addnode(edge[u], v);
		addnode(edge[v], u);
	}
}

long long main1()
{
	long long test[100] = { 1,2,3,4 };
	NTT(test, 8, 1);
	print(test, 8);
	NTT(test, 8, -1);
	print(test, 8);
}

int main()
{
	init();
	solve();

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

string to_string(string s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

const int md = 998244353;

inline void add(int &a, int b) {
  a += b;
  if (a >= md) a -= md;
}

inline void sub(int &a, int b) {
  a -= b;
  if (a < 0) a += md;
}

inline int mul(int a, int b) {
#if !defined(_WIN32) || defined(_WIN64)
  return (int) ((long long) a * b % md);
#endif
  unsigned long long x = (long long) a * b;
  unsigned xh = (unsigned) (x >> 32), xl = (unsigned) x, d, m;
  asm(
    "divl %4; \n\t"
    : "=a" (d), "=d" (m)
    : "d" (xh), "a" (xl), "r" (md)
  );
  return m;
}

inline int power(int a, long long b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}

inline int inv(int a) {
  a %= md;
  if (a < 0) a += md;
  int b = md, u = 0, v = 1;
  while (a) {
    int t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}

namespace ntt {
  int base = 1;
  vector<int> roots = {0, 1};
  vector<int> rev = {0, 1};
  int max_base = -1;
  int root = -1;

  void init() {
    int tmp = md - 1;
    max_base = 0;
    while (tmp % 2 == 0) {
      tmp /= 2;
      max_base++;
    }
    root = 2;
    while (true) {
      if (power(root, 1 << max_base) == 1) {
        if (power(root, 1 << (max_base - 1)) != 1) {
          break;
        }
      }
      root++;
    }
  }

  void ensure_base(int nbase) {
    if (max_base == -1) {
      init();
    }
    if (nbase <= base) {
      return;
    }
    assert(nbase <= max_base);
    rev.resize(1 << nbase);
    for (int i = 0; i < (1 << nbase); i++) {
      rev[i] = (rev[i >> 1] >> 1) + ((i & 1) << (nbase - 1));
    }
    roots.resize(1 << nbase);
    while (base < nbase) {
      int z = power(root, 1 << (max_base - 1 - base));
      for (int i = 1 << (base - 1); i < (1 << base); i++) {
        roots[i << 1] = roots[i];
        roots[(i << 1) + 1] = mul(roots[i], z);
      }
      base++;
    }
  }

  void fft(vector<int> &a) {
    int n = (int) a.size();
    assert((n & (n - 1)) == 0);
    int zeros = __builtin_ctz(n);
    ensure_base(zeros);
    int shift = base - zeros;
    for (int i = 0; i < n; i++) {
      if (i < (rev[i] >> shift)) {
        swap(a[i], a[rev[i] >> shift]);
      }
    }
    for (int k = 1; k < n; k <<= 1) {
      for (int i = 0; i < n; i += 2 * k) {
        for (int j = 0; j < k; j++) {
          int x = a[i + j];
          int y = mul(a[i + j + k], roots[j + k]);
          a[i + j] = x + y - md;
          if (a[i + j] < 0) a[i + j] += md;
          a[i + j + k] = x - y + md;
          if (a[i + j + k] >= md) a[i + j + k] -= md;
        }
      }
    }
  }

  vector<int> multiply(vector<int> a, vector<int> b, int eq = 0) {
    int need = (int) (a.size() + b.size() - 1);
    int nbase = 0;
    while ((1 << nbase) < need) nbase++;
    ensure_base(nbase);
    int sz = 1 << nbase;
    a.resize(sz);
    b.resize(sz);
    fft(a);
    if (eq) b = a; else fft(b);
    int inv_sz = inv(sz);
    for (int i = 0; i < sz; i++) {
      a[i] = mul(mul(a[i], b[i]), inv_sz);
    }
    reverse(a.begin() + 1, a.end());
    fft(a);
    a.resize(need);
    return a;
  }

  vector<int> square(vector<int> a) {
    return multiply(a, a, 1);
  }
}

vector<vector<int>> vect;

vector<int> multiply_all(int from, int to) {
  if (from == to) {
    return {1};
  }
  if (from + 1 == to) {
    return vect[from];
  }
  int mid = (from + to) >> 1;
  return ntt::multiply(multiply_all(from, mid), multiply_all(mid, to));
}

const int N = 400010;

vector<int> g[N];
int sz[N];
int pv[N];
int val[N];
int sum_val[N];
int memo[N];
int touched[N], ITER;
vector<int> all;
int n, k;
int ans;

void dfs(int v, int pr) {
  pv[v] = pr;
  all.push_back(v);
  sz[v] = 1;
  sum_val[v] = 0;
  vector<int> children;
  for (int u : g[v]) {
    if (u == pr) {
      continue;
    }
    children.push_back(u);
    dfs(u, v);
    sz[v] += sz[u];
    add(ans, mul(sum_val[u], sum_val[v]));
    add(sum_val[v], sum_val[u]);
  }
  vect.clear();
  for (int u : children) {
    vect.push_back({1, sz[u]});
  }
  vector<int> res = multiply_all(0, (int) vect.size());
  assert(res.size() == vect.size() + 1);
  int ways = 1;
  val[v] = 0;
  for (int i = 0; i <= min(k, (int) vect.size()); i++) {
    add(val[v], mul(ways, res[i]));
    ways = mul(ways, k - i);
  }
  add(sum_val[v], val[v]);
  if (pr != -1) {
    res = ntt::multiply(res, {1, n - sz[v]});
  }
  ITER++;
  for (int it = 0; it < (int) children.size(); it++) {
    int S = sz[children[it]];
    int &vall = memo[S];
    if (touched[S] != ITER) {
      touched[S] = ITER;
      vall = 0;
      int cur = 0;
      ways = 1;
      for (int i = 0; i <= min(k, (int) res.size() - 1); i++) {
        cur = mul(cur, S);
        cur = (res[i] - cur + md) % md;
        add(vall, mul(ways, cur));
        ways = mul(ways, k - i);
      }
      assert(cur == 0);
    }
    add(ans, mul(vall, sum_val[children[it]]));
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    g[i].clear();
  }
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    x--; y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  for (int i = 0; i <= n; i++) {
    memo[i] = -1;
    touched[i] = -1;
  }
  ITER = 0;
  ans = 0;
  if (k == 1) {
    ans = mul(mul(n, n - 1), inv(2));
  } else {
    dfs(0, -1);
  }
  cout << ans << '\n';
  return 0;
}


// Written by newbiechd
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>

// Delete the debugging information!
#define debug(x) std::cerr << #x << " = " << x << std::endl;

const int BUFFER_SIZE = 1 << 25 | 1;
struct InputOutputStream {
  char ibuf[BUFFER_SIZE], obuf[BUFFER_SIZE], *s, *oh;
  InputOutputStream() : s(ibuf), oh(obuf) {
#ifndef ONLINE_JUDGE
    freopen("a.in", "r", stdin);
    // freopen("a.out", "w", stdout);
#endif
    ibuf[fread(ibuf, 1, BUFFER_SIZE, stdin)] = '\0';
  }
  ~InputOutputStream() { fwrite(obuf, 1, oh - obuf, stdout); }
  template <typename T>
  inline InputOutputStream &operator>>(T &x) {
    while (!isdigit(*s)) ++s;
    for (x = 0; isdigit(*s); ++s)
      x = x * 10 + (*s ^ '0');
    return *this;
  }
  template <typename T>
  inline InputOutputStream &operator<<(T x) {
    static char buf[23];
    register char *top = buf;
    if (x) {
      for (T t; x; )
        t = x / 10, *top++ = x - t * 10 + 48, x = t;
      while (top != buf)
        *oh++ = *--top;
    }
    else
      *oh++ = '0';
    *oh++ = ' ';
    return *this;
  }
}IO;

template <typename lhs, typename rhs>
inline lhs min(const lhs &x, const rhs &y) { return x < y ? x : y; }
template <typename lhs, typename rhs>
inline lhs max(const lhs &x, const rhs &y) { return x > y ? x : y; }

const int N_MAX = 131077;
int n, K;
std::vector<int> g[N_MAX];

const int mod = 998244353;
inline int power(int x, int y) {
  int o = 1;
  while (y) {
    if (y & 1)
      o = 1ll * o * x % mod;
    x = 1ll * x * x % mod, y >>= 1;
  }
  return o;
}

typedef std::vector<int> Poly;
inline void operator+=(Poly &f, const Poly &g) {
  const int m = g.size();
  if ((int)f.size() < m)
    f.resize(m);
  for (int i = 0; i < m; ++i)
    f[i] = (f[i] + g[i]) % mod;
}
inline Poly operator+(Poly f, Poly g) {
  f += g;
  return f;
}

int unitRoot[N_MAX], rev[N_MAX];
inline int getLen(int n) { return 1 << (32 - __builtin_clz(n)); }
inline int prepare(int n) {
  const int len = getLen(n);
  for (int i = 1; i < len; ++i)
    rev[i] = (rev[i >> 1] >> 1) | (i & 1 ? len >> 1 : 0);
  return len;
}

inline void FFT(Poly &f, int len) {
  for (int i = 1; i < len; ++i)
    if (i < rev[i])
      std::swap(f[i], f[rev[i]]);
  for (int i = 1; i < len; i <<= 1)
    for (int j = 0; j < len; j += i << 1)
      for (int k = 0; k < i; ++k) {
        int x = f[j | k], y = 1ll * f[i | j | k] * unitRoot[i | k] % mod;
        f[j | k] = (x + y) % mod, f[i | j | k] = (x - y) % mod;
      }
}

inline void operator*=(Poly &f, Poly g) {
  const int n = f.size(), m = g.size(), k = n + m - 1, len = prepare(k);
  f.resize(len), FFT(f, len), g.resize(len), FFT(g, len);
  for (int i = 0; i < len; ++i)
    f[i] = 1ll * f[i] * g[i] % mod;
  FFT(f, len), std::reverse(&f[1], &f[len]), f.resize(k);
  const int invLen = power(len, mod - 2);
  for (int i = 0; i < k; ++i)
    f[i] = 1ll * f[i] * invLen % mod;
}
inline Poly operator*(Poly f, Poly g) {
  f *= g;
  return f;
}

inline Poly makePoly0(int a) {
  Poly temp(1);
  temp[0] = a;
  return temp;
}
inline Poly makePoly1(int a) {
  Poly temp(2);
  temp[0] = 1, temp[1] = a;
  return temp;
}

int ans, siz[N_MAX], sum[N_MAX];
std::vector<int> *now;
#define mid ((l + r) >> 1)
std::pair<Poly, Poly> divideConquer(int l, int r) {
  if (l == r)
    return make_pair(makePoly1(siz[(*now)[l]]), makePoly0(sum[(*now)[l]]));
  std::pair<Poly, Poly> L = divideConquer(l, mid),
    R = divideConquer(mid + 1, r);
  return make_pair(L.first * R.first, L.first * R.second + L.second * R.first);
}
#undef mid

int fac[N_MAX], iFac[N_MAX];
inline int calc(Poly f) {
  const int n = min(K + 1, (int)f.size());
  int o = 0;
  for (int i = 0; i < n; ++i)
    o = (1ll * iFac[K - i] * f[i] + o) % mod;
  return 1ll * o * fac[K] % mod;
}

inline void multiply(Poly &f, int a) {
  const int n = f.size();
  f.push_back(0);
  for (int i = n - 1; ~i; --i)
    f[i + 1] = (1ll * f[i] * a + f[i + 1]) % mod;
}

void dfs(int x, int f) {
  siz[x] = 1;
  std::vector<int> arr;
  for (int y : g[x])
    if (y != f) {
      dfs(y, x), siz[x] += siz[y], arr.push_back(y);
      ans = (1ll * sum[x] * sum[y] + ans) % mod;
      sum[x] = (sum[x] + sum[y]) % mod;
    }
  if (arr.empty()) {
    sum[x] = 1;
    return ;
  }
  now = &arr;
  std::pair<Poly, Poly> temp = divideConquer(0, arr.size() - 1);
  sum[x] = (sum[x] + calc(temp.first)) % mod;
  multiply(temp.second, n - siz[x]);
  ans = (ans + calc(temp.second)) % mod;
}

int main() {

  IO >> n >> K;
  if (K == 1) {
    printf("%lld\n", 499122177ll * n * (n - 1) % mod);
    return 0;
  }
  for (int i = 1; i < n; ++i) {
    int x, y;
    IO >> x >> y;
    g[x].push_back(y), g[y].push_back(x);
  }
  fac[0] = 1;
  for (int i = 1; i <= K; ++i)
    fac[i] = 1ll * fac[i - 1] * i % mod;
  iFac[K] = power(fac[K], mod - 2);
  for (int i = K; i; --i)
    iFac[i - 1] = 1ll * iFac[i] * i % mod;
  const int len = getLen(n);
  for (int i = 1; i < len; i <<= 1) {
    const int temp = power(3, (mod - 1) / (i << 1));
    unitRoot[i] = 1;
    for (int j = 1; j < i; ++j)
      unitRoot[i | j] = 1ll * unitRoot[(i | j) - 1] * temp % mod;
  }

  dfs(1, 0);
  printf("%d\n", (ans + mod) % mod);
  return 0;
}


// Written by newbiechd
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>

// Delete the debugging information!
#define debug(x) std::cerr << #x << " = " << x << std::endl;

const int BUFFER_SIZE = 1 << 25 | 1;
struct InputOutputStream {
  char ibuf[BUFFER_SIZE], obuf[BUFFER_SIZE], *s, *oh;
  InputOutputStream() : s(ibuf), oh(obuf) {
#ifndef ONLINE_JUDGE
    freopen("a.in", "r", stdin);
    // freopen("a.out", "w", stdout);
#endif
    ibuf[fread(ibuf, 1, BUFFER_SIZE, stdin)] = '\0';
  }
  ~InputOutputStream() { fwrite(obuf, 1, oh - obuf, stdout); }
  template <typename T>
  inline InputOutputStream &operator>>(T &x) {
    while (!isdigit(*s)) ++s;
    for (x = 0; isdigit(*s); ++s)
      x = x * 10 + (*s ^ '0');
    return *this;
  }
  template <typename T>
  inline InputOutputStream &operator<<(T x) {
    static char buf[23];
    register char *top = buf;
    if (x) {
      for (T t; x; )
        t = x / 10, *top++ = x - t * 10 + 48, x = t;
      while (top != buf)
        *oh++ = *--top;
    }
    else
      *oh++ = '0';
    *oh++ = ' ';
    return *this;
  }
}IO;

template <typename lhs, typename rhs>
inline lhs min(const lhs &x, const rhs &y) { return x < y ? x : y; }
template <typename lhs, typename rhs>
inline lhs max(const lhs &x, const rhs &y) { return x > y ? x : y; }

const int N_MAX = 131077;
int n, K;
std::vector<int> g[N_MAX];

const int mod = 998244353;
inline int power(int x, int y) {
  int o = 1;
  while (y) {
    if (y & 1)
      o = 1ll * o * x % mod;
    x = 1ll * x * x % mod, y >>= 1;
  }
  return o;
}

typedef std::vector<int> Poly;
inline void operator+=(Poly &f, const Poly &g) {
  const int m = g.size();
  if ((int)f.size() < m)
    f.resize(m);
  for (int i = 0; i < m; ++i)
    f[i] = (f[i] + g[i]) % mod;
}

int unitRoot[N_MAX], rev[N_MAX];
inline int getLen(int n) { return 1 << (32 - __builtin_clz(n)); }
inline int prepare(int n) {
  const int len = getLen(n);
  for (int i = 1; i < len; ++i)
    rev[i] = (rev[i >> 1] >> 1) | (i & 1 ? len >> 1 : 0);
  return len;
}

inline void FFT(Poly &f, int len) {
  for (int i = 1; i < len; ++i)
    if (i < rev[i])
      std::swap(f[i], f[rev[i]]);
  for (int i = 1; i < len; i <<= 1)
    for (int j = 0; j < len; j += i << 1)
      for (int k = 0; k < i; ++k) {
        int x = f[j | k], y = 1ll * f[i | j | k] * unitRoot[i | k] % mod;
        f[j | k] = (x + y) % mod, f[i | j | k] = (x - y) % mod;
      }
}

inline void operator*=(Poly &f, Poly g) {
  const int n = f.size(), m = g.size(), k = n + m - 1, len = prepare(k);
  f.resize(len), FFT(f, len), g.resize(len), FFT(g, len);
  for (int i = 0; i < len; ++i)
    f[i] = 1ll * f[i] * g[i] % mod;
  FFT(f, len), std::reverse(&f[1], &f[len]), f.resize(k);
  const int invLen = power(len, mod - 2);
  for (int i = 0; i < k; ++i)
    f[i] = 1ll * f[i] * invLen % mod;
}
inline Poly operator*(Poly f, Poly g) {
  f *= g;
  return f;
}

inline Poly makePoly(int a) {
  Poly temp(2);
  temp[0] = 1, temp[1] = a;
  return temp;
}

std::vector<int> *now;
#define mid ((l + r) >> 1)
Poly divideConquer(int l, int r) {
  if (l == r)
    return makePoly((*now)[l]);
  return divideConquer(l, mid) * divideConquer(mid + 1, r);
}
#undef mid

inline void multiply(Poly &f, int a) {
  const int n = f.size();
  f.push_back(0);
  for (int i = n - 1; ~i; --i)
    f[i + 1] = (1ll * f[i] * a + f[i + 1]) % mod;
}
inline void divide(Poly &f, int a) {
  const int n = f.size(), inv = power(a, mod - 2);
  for (int i = n - 1; i; --i)
    f[i] = 1ll * f[i] * inv % mod, f[i - 1] = (f[i - 1] - f[i]) % mod;
  for (int i = 1; i < n; ++i)
    f[i - 1] = f[i];
  f.pop_back();
}

int fac[N_MAX], iFac[N_MAX];
inline int calc(Poly f) {
  const int n = min(K + 1, (int)f.size());
  int o = 0;
  for (int i = 0; i < n; ++i)
    o = (1ll * iFac[K - i] * f[i] + o) % mod;
  return 1ll * o * fac[K] % mod;
}

int ans, siz[N_MAX], dp[N_MAX], sum[N_MAX];
Poly pack[N_MAX];
void dfs(int x, int f) {
  siz[x] = 1;
  std::vector<int> arr;
  for (int y : g[x])
    if (y != f) {
      dfs(y, x), siz[x] += siz[y], arr.push_back(siz[y]);
      ans = (1ll * sum[x] * sum[y] + ans) % mod;
      sum[x] = (sum[x] + sum[y]) % mod;
    }
  now = &arr;
  Poly temp = arr.size() ? divideConquer(0, arr.size() - 1) : makePoly(0);
  dp[x] = calc(temp), sum[x] = (sum[x] + dp[x]) % mod;
  multiply(temp, n - siz[x]);
  for (int y : g[x])
    if (y != f) {
      divide(temp, siz[y]);
      ans = (1ll * sum[y] * calc(temp) + ans) % mod;
      multiply(temp, siz[y]);
    }
}

/*
inline void Debug() {
  Poly f(3), g(3);
  f[0] = 1, f[1] = 1, f[2] = 4, g[0] = 5, g[1] = 1, g[2] = 4;
  f *= g;
  for (int i = 0; i < 5; ++i)
    debug(f[i]);
}
*/

int main() {

  IO >> n >> K;
  if (K == 1) {
    printf("%lld\n", 499122177ll * n * (n - 1) % mod);
    return 0;
  }
  for (int i = 1; i < n; ++i) {
    int x, y;
    IO >> x >> y;
    g[x].push_back(y), g[y].push_back(x);
  }
  fac[0] = 1;
  for (int i = 1; i <= K; ++i)
    fac[i] = 1ll * fac[i - 1] * i % mod;
  iFac[K] = power(fac[K], mod - 2);
  for (int i = K; i; --i)
    iFac[i - 1] = 1ll * iFac[i] * i % mod;
  const int len = getLen(n);
  // const int len = 8;
  for (int i = 1; i < len; i <<= 1) {
    const int temp = power(3, (mod - 1) / (i << 1));
    unitRoot[i] = 1;
    for (int j = 1; j < i; ++j)
      unitRoot[i | j] = 1ll * unitRoot[(i | j) - 1] * temp % mod;
  }

  // Debug();

  dfs(1, 0);
  printf("%d\n", (ans + mod) % mod);
  return 0;
}


// Written by newbiechd
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>

// Delete the debugging information!
#define debug(x) std::cerr << #x << " = " << x << std::endl;

const int BUFFER_SIZE = 1 << 25 | 1;
struct InputOutputStream {
  char ibuf[BUFFER_SIZE], obuf[BUFFER_SIZE], *s, *oh;
  InputOutputStream() : s(ibuf), oh(obuf) {
#ifndef ONLINE_JUDGE
    freopen("a.in", "r", stdin);
    // freopen("a.out", "w", stdout);
#endif
    ibuf[fread(ibuf, 1, BUFFER_SIZE, stdin)] = '\0';
  }
  ~InputOutputStream() { fwrite(obuf, 1, oh - obuf, stdout); }
  template <typename T>
  inline InputOutputStream &operator>>(T &x) {
    while (!isdigit(*s)) ++s;
    for (x = 0; isdigit(*s); ++s)
      x = x * 10 + (*s ^ '0');
    return *this;
  }
  template <typename T>
  inline InputOutputStream &operator<<(T x) {
    static char buf[23];
    register char *top = buf;
    if (x) {
      for (T t; x; )
        t = x / 10, *top++ = x - t * 10 + 48, x = t;
      while (top != buf)
        *oh++ = *--top;
    }
    else
      *oh++ = '0';
    *oh++ = ' ';
    return *this;
  }
}IO;

template <typename lhs, typename rhs>
inline lhs min(const lhs &x, const rhs &y) { return x < y ? x : y; }
template <typename lhs, typename rhs>
inline lhs max(const lhs &x, const rhs &y) { return x > y ? x : y; }

const int N_MAX = 131077;
int n, K;
std::vector<int> g[N_MAX];

const int mod = 998244353;
inline int power(int x, int y) {
  int o = 1;
  while (y) {
    if (y & 1)
      o = 1ll * o * x % mod;
    x = 1ll * x * x % mod, y >>= 1;
  }
  return o;
}

typedef std::vector<int> Poly;
inline void operator+=(Poly &f, const Poly &g) {
  const int m = g.size();
  if ((int)f.size() < m)
    f.resize(m);
  for (int i = 0; i < m; ++i)
    f[i] = (f[i] + g[i]) % mod;
}

int unitRoot[N_MAX], rev[N_MAX];
inline int getLen(int n) { return 1 << (32 - __builtin_clz(n)); }
inline int prepare(int n) {
  const int len = getLen(n);
  for (int i = 1; i < len; ++i)
    rev[i] = (rev[i >> 1] >> 1) | (i & 1 ? len >> 1 : 0);
  return len;
}

inline void FFT(Poly &f, int len) {
  for (int i = 1; i < len; ++i)
    if (i < rev[i])
      std::swap(f[i], f[rev[i]]);
  for (int i = 1; i < len; i <<= 1)
    for (int j = 0; j < len; j += i << 1)
      for (int k = 0; k < i; ++k) {
        int x = f[j | k], y = 1ll * f[i | j | k] * unitRoot[i | k] % mod;
        f[j | k] = (x + y) % mod, f[i | j | k] = (x - y) % mod;
      }
}

inline void operator*=(Poly &f, Poly g) {
  const int n = f.size(), m = g.size(), k = n + m - 1, len = prepare(k);
  f.resize(len), FFT(f, len), g.resize(len), FFT(g, len);
  for (int i = 0; i < len; ++i)
    f[i] = 1ll * f[i] * g[i] % mod;
  FFT(f, len), std::reverse(&f[1], &f[len]), f.resize(k);
  const int invLen = power(len, mod - 2);
  for (int i = 0; i < k; ++i)
    f[i] = 1ll * f[i] * invLen % mod;
}
inline Poly operator*(Poly f, Poly g) {
  f *= g;
  return f;
}

inline Poly makePoly(int a) {
  Poly temp(2);
  temp[0] = 1, temp[1] = a;
  return temp;
}

std::vector<int> *now;
#define mid ((l + r) >> 1)
Poly divideConquer(int l, int r) {
  if (l == r)
    return makePoly((*now)[l]);
  return divideConquer(l, mid) * divideConquer(mid + 1, r);
}
#undef mid

inline void multiply(Poly &f, int a) {
  const int n = f.size();
  f.push_back(0);
  for (int i = n - 1; ~i; --i)
    f[i + 1] = (1ll * f[i] * a + f[i + 1]) % mod;
}
inline void divide(Poly &f, int a) {
  const int n = f.size(), inv = power(a, mod - 2);
  for (int i = n - 1; i; --i)
    f[i] = 1ll * f[i] * inv % mod, f[i - 1] = (f[i - 1] - f[i]) % mod;
  for (int i = 1; i < n; ++i)
    f[i - 1] = f[i];
  f.pop_back();
}

int fac[N_MAX], iFac[N_MAX];
inline int calc(Poly f) {
  const int n = min(K + 1, (int)f.size());
  int o = 0;
  for (int i = 0; i < n; ++i)
    o = (1ll * iFac[K - i] * f[i] + o) % mod;
  return 1ll * o * fac[K] % mod;
}

int ans, siz[N_MAX], dp[N_MAX], sum[N_MAX];
Poly pack[N_MAX];
int tub[N_MAX], vis[N_MAX], tim;
void dfs(int x, int f) {
  siz[x] = 1;
  std::vector<int> arr;
  for (int y : g[x])
    if (y != f) {
      dfs(y, x), siz[x] += siz[y], arr.push_back(siz[y]);
      ans = (1ll * sum[x] * sum[y] + ans) % mod;
      sum[x] = (sum[x] + sum[y]) % mod;
    }
  // assert(x == 1);
  now = &arr;
  Poly temp = arr.size() ? divideConquer(0, arr.size() - 1) : makePoly(0);
  // assert(x == 1);
  dp[x] = calc(temp), sum[x] = (sum[x] + dp[x]) % mod;
  multiply(temp, n - siz[x]), ++tim;
  for (int y : g[x])
    if (y != f) {
      if (vis[siz[y]] == tim)
        ans = (1ll * sum[y] * tub[siz[y]] + ans) % mod;
      else {
        vis[siz[y]] = tim;
        divide(temp, siz[y]);
        ans = (1ll * sum[y] * (tub[siz[y]] = calc(temp)) + ans) % mod;
        multiply(temp, siz[y]);
      }
    }
}

/*
inline void Debug() {
  Poly f(3), g(3);
  f[0] = 1, f[1] = 1, f[2] = 4, g[0] = 5, g[1] = 1, g[2] = 4;
  f *= g;
  for (int i = 0; i < 5; ++i)
    debug(f[i]);
}
*/

int main() {

  IO >> n >> K;
  if (K == 1) {
    printf("%lld\n", 499122177ll * n * (n - 1) % mod);
    return 0;
  }
  for (int i = 1; i < n; ++i) {
    int x, y;
    IO >> x >> y;
    g[x].push_back(y), g[y].push_back(x);
  }
  fac[0] = 1;
  for (int i = 1; i <= K; ++i)
    fac[i] = 1ll * fac[i - 1] * i % mod;
  iFac[K] = power(fac[K], mod - 2);
  for (int i = K; i; --i)
    iFac[i - 1] = 1ll * iFac[i] * i % mod;
  const int len = getLen(n);
  // const int len = 8;
  for (int i = 1; i < len; i <<= 1) {
    const int temp = power(3, (mod - 1) / (i << 1));
    unitRoot[i] = 1;
    for (int j = 1; j < i; ++j)
      unitRoot[i | j] = 1ll * unitRoot[(i | j) - 1] * temp % mod;
  }

  // Debug();

  dfs(1, 0);
  printf("%d\n", (ans + mod) % mod);
  return 0;
}