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

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

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

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

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

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

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


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

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

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

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

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

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

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


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

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

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

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

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

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

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


#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#define ll long long
#define MOD(x) ((x)>=mod?((x)-mod):(x))
using namespace std;
const int maxn=1<<18, inf=1e9+233, mod=998244353;
struct edge{int too, pre;}e[maxn<<1];
int n, tot, N, ans, K, x, y;
int fac[maxn], inv[maxn], last[maxn], size[maxn], f[maxn], g[maxn], a[18][maxn], son[maxn], w[maxn], c[maxn];

template<typename T>
inline void read(T &k)
{
    int f=1; k=0; char c=getchar();
    while(c<'0' || c>'9') c=='-' && (f=-1), c=getchar();
    while(c<='9' && c>='0') k=k*10+c-'0', c=getchar();
    k*=f;
}

inline bool cmp(int a, int b) {return size[a]<size[b];}

inline void add(int x, int y) {e[++tot]=(edge){y, last[x]}; last[x]=tot;}

inline int C(int n, int m) {return 1ll*fac[n]*inv[m]%mod*inv[n-m]%mod;}

inline int power(int a, int b)
{
    int ans=1;
    for(;b;b>>=1, a=1ll*a*a%mod)
    if(b&1) ans=1ll*ans*a%mod;
    return ans;
}

inline void ntt(int *a, int f)
{
    for(int i=0, j=0;i<N;i++)
    {
        if(i<j) swap(a[i], a[j]);
        for(int k=N>>1;(j^=k)<k;k>>=1);
    }
    for(int i=2;i<=N;i<<=1)
    {
        int m=i>>1, base=power(3, (mod-1)/i);
        if(f==-1) base=power(base, mod-2);
        w[0]=1; for(int j=1;j<m;j++) w[j]=1ll*w[j-1]*base%mod;
        for(int j=0;j<N;j+=i)
        {
            for(int k=0;k<m;k++)
            {
                int t=1ll*a[j+k+m]*w[k]%mod;
                a[j+k+m]=MOD(a[j+k]-t+mod);
                a[j+k]=MOD(a[j+k]+t);
            }
        }
    }
    if(f==-1) for(int i=0, inv=power(N, mod-2);i<N;i++) a[i]=1ll*a[i]*inv%mod;
}

void solve(int x, int l, int r)
{
//  printf("x:%d l:%d r:%d\n", x, l, r);
    if(l==r) return a[x][0]=1, (void)(a[x][1]=size[son[l]]);
    int mid=(l+r)>>1;
    solve(x+1, l, mid);
    for(N=1;N<=(r-l+1);N<<=1);
    for(int i=0;i<N;i++) a[x][i]=a[x+1][i];
    solve(x+1, mid+1, r);
    for(N=1;N<=(r-l+1);N<<=1);
    for(int i=mid-l+2;i<N;i++) a[x][i]=0;
    for(int i=r-mid+1;i<N;i++) a[x+1][i]=0;
    ntt(a[x], 1); ntt(a[x+1], 1);
    for(int i=0;i<N;i++) a[x][i]=1ll*a[x][i]*a[x+1][i]%mod;
    ntt(a[x], -1);
}

void dfs(int x, int fa)
{
//  printf("x:%d fa:%d\n", x, fa);
    size[x]=1; int cnt=0, sum=0;
    for(int i=last[x], too;i;i=e[i].pre)
    if((too=e[i].too)!=fa)
    {
//    	printf("x:%d too:%d\n", x, too);
        dfs(too, x);
        size[x]+=size[too];
        g[x]=MOD(g[x]+g[too]);
        ans=(ans+1ll*sum*g[too])%mod;
        sum=MOD(sum+g[too]);
    }
    for(int i=last[x], too;i;i=e[i].pre)
    if((too=e[i].too)!=fa) son[++cnt]=too;
//    puts("QAQ");
    a[0][0]=1;
    if(cnt) solve(0, 1, cnt);
//    puts("OWO");
    for(int i=0;i<=cnt && i<=K;i++) f[x]=(f[x]+1ll*C(K, i)*a[0][i]%mod*fac[i])%mod;
    g[x]=MOD(g[x]+f[x]);
    sort(son+1, son+1+cnt, cmp);
    int delta=0;
//    printf("x:%d\n", x);
//    for(int i=0;i<=cnt && i<=K;i++) printf("%d ", a[0][i]); puts("");
//    printf("x:%d cnt:%d\n", x, cnt);
    for(int i=1;i<=cnt;i++)
    {
        if(size[son[i]]!=size[son[i-1]])
        {
        	delta=0; c[0]=1;
            for(int j=1;j<=cnt;j++)
            c[j]=(a[0][j]-1ll*c[j-1]*size[son[i]]%mod+mod), c[j]=MOD(c[j]);
            c[cnt]=0;
            for(int j=cnt;j;j--)
            c[j]=(c[j]+1ll*c[j-1]*(n-size[x]))%mod;
            for(int j=0;j<=cnt && j<=K;j++) delta=(delta+1ll*C(K, j)*c[j]%mod*fac[j])%mod;
//			, printf("j:%d deltadelta:%lld\n", j, 1ll*C(K, j)*c[j]%mod*fac[j]%mod);
        }
        ans=(ans+1ll*delta*g[son[i]])%mod;
//	    puts("QAQ"); printf("cnt:%d K:%d\n", cnt, K);
//		printf("x:%d son[i]:%d delta:%d\n", x, son[i], delta);
//	    for(int j=0;j<=cnt && j<=K;j++) printf("x:%d j:%d c[j]:%d\n", x, j, c[j]);
    }
//    printf("x:%d f[x]:%d g[x]:%d\n", x, f[x], g[x]);
}

int main()
{
//    freopen("1.in", "r", stdin);
    read(n); read(K); if(K==1) return printf("%lld\n", (1ll*n*(n-1)>>1)%mod), 0;
    fac[0]=1; for(int i=1;i<=n;i++) fac[i]=1ll*fac[i-1]*i%mod;
    inv[n]=power(fac[n], mod-2); for(int i=n;i;i--) inv[i-1]=1ll*inv[i]*i%mod;
    for(int i=1;i<n;i++) read(x), read(y), add(x, y), add(y, x);
    dfs(1, 0); printf("%d\n", ans);
}


// CF 981H
// DeP
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

const int LOG = 18, MAXN = 1 << LOG | 1, P = 998244353, iv2 = 499122177;

int W[LOG][MAXN];
int fac[MAXN], ifac[MAXN], inv[MAXN];

inline int comb(int n, int m) {
  return (n < m)? 0: 1LL * fac[n] * ifac[n - m] % P;
}

int fpow(int base, int b) {
  int ret = 1;
  while (b > 0) {
    if (b & 1) ret = 1LL * ret * base % P;
    base = 1LL * base * base % P, b >>= 1;
  }
  return ret;
}

namespace Poly {
  int r[MAXN];
  inline void init(const int& Lim, const int& L) {
    for (int i = 1; i < Lim; ++i) r[i] = (r[i>>1] >> 1) | ((i & 1) << (L-1));
  }

  void NTT(int* f, const int& Lim, const int& type) {
    for (int i = 1; i < Lim; ++i) if (i < r[i]) swap(f[i], f[r[i]]);
    for (int k = 0, Mid = 1; Mid < Lim; Mid <<= 1, ++k) {
      const int* w = W[k];
      for (int i = 0; i < Lim; i += Mid << 1)
        for (int j = 0; j < Mid; ++j) {
          int f0 = f[i+j], f1 = 1LL * w[j] * f[i+j+Mid] % P;
          f[i+j] = (f0 + f1) % P, f[i+j+Mid] = (f0 - f1 + P) % P;
        }
    }
    if (type < 0) {
      int iv = fpow(Lim, P - 2);
      for (int i = 0; i < Lim; ++i) f[i] = 1LL * f[i] * iv % P;
      reverse(f + 1, f + Lim);
    }
  }
}

void PolyPre(int N) {
  inv[1] = 1;
  for (int i = 2; i <= N; ++i)
    inv[i] = 1LL * inv[P % i] * (P - P / i) % P;
  fac[0] = ifac[0] = 1;
  for (int i = 1; i <= N; ++i) {
    fac[i] = 1LL * i * fac[i - 1] % P;
    ifac[i] = 1LL * inv[i] * ifac[i - 1] % P;
  }
  for (int w, k = 0, Mid = 1; k < LOG; ++k, Mid <<= 1) {
    W[k][0] = 1, W[k][1] = w = fpow(3, (P - 1) / (Mid << 1));
    for (int i = 1; i < Mid; ++i)
      W[k][i] = 1LL * w * W[k][i - 1] % P;
  }
}

typedef vector<int> poly;
typedef pair<int, int> Pii;

poly operator * (const poly& f, const poly& g) {
  static int A[MAXN], B[MAXN];
  int Lim = 1, L = 0, n = f.size(), m = g.size();
  while (Lim < n + m - 1) Lim <<= 1, ++L;
  for (int i = 0; i < Lim; ++i)
    A[i] = (i < n)? f[i]: 0, B[i] = (i < m)? g[i]: 0;
  Poly::init(Lim, L), Poly::NTT(A, Lim, 1), Poly::NTT(B, Lim, 1);
  for (int i = 0; i < Lim; ++i) A[i] = 1LL * A[i] * B[i] % P;
  Poly::NTT(A, Lim, -1);
  poly h(n + m - 1, 0);
  for (int i = 0; i < n + m - 1; ++i) h[i] = A[i];
  return h;
}

poly operator + (const poly& f, const poly& g) {
  poly h(max(f.size(), g.size()), 0);
  for (size_t i = 0; i < h.size(); ++i) {
    int fi = (i < f.size())? f[i]: 0, gi = (i < g.size())? g[i]: 0;
    h[i] = (fi + gi) % P;
  }
  return h;
}

inline int pls(const int& a, const int& b) { return (a + b) % P; }
inline int mns(const int& a, const int& b) { return (a - b + P) % P; }
inline int mlt(const int& a, const int& b) { return 1LL * a * b % P; }

int n, K;
vector<int> Adj[MAXN], Son[MAXN];

int ans, s1, s2;
int size[MAXN], f[MAXN], sf[MAXN];

void solve(const int& u, int L, int R, poly& F, poly& G) {
  if (L == R) {
    int v = Son[u][L];
    F.resize(2), F[0] = 1, F[1] = size[v];
    G.resize(2), G[0] = pls(f[v], sf[v]), G[1] = mlt(n - size[u], G[0]);
    return;
  }
  int Mid = (L + R) / 2;
  poly f0, f1, g0, g1;
  solve(u, L, Mid, f0, g0), solve(u, Mid + 1, R, f1, g1);
  F = f0 * f1, G = g0 * f1 + g1 * f0;
}

void dfs(int u, int fa) {
  size[u] = 1;
  for (const int& v: Adj[u]) if (v != fa) {
    dfs(v, u), size[u] += size[v];
    Son[u].push_back(v);
    sf[u] = pls(sf[u], pls(f[v], sf[v]));
  }
  if (Son[u].empty())
    Son[u].push_back(0);
  poly F, G;
  solve(u, 0, Son[u].size() - 1, F, G);
  for (int i = 0; i <= min(K, (int) F.size() - 1); ++i)
    f[u] = pls(f[u], mlt(F[i], comb(K, i)));
  s1 = pls(s1, f[u]), s2 = pls(s2, mlt(f[u], f[u]));
  ans = mns(ans, mlt(f[u], sf[u]));
  for (int i = 0; i <= min(K, (int) G.size() - 1); ++i)
    ans = pls(ans, mlt(G[i], comb(K, i)));
}

int main() {
#ifndef ONLINE_JUDGE
  freopen("input.in", "r", stdin);
#endif
  scanf("%d%d", &n, &K);
  for (int u, v, i = 1; i < n; ++i) {
    scanf("%d%d", &u, &v);
    Adj[u].push_back(v), Adj[v].push_back(u);
  }

  if (K == 1)
    ans = 1LL * n * (n - 1) / 2 % P;
  else {
    PolyPre(K), dfs(1, 0);
    ans = pls(ans, mlt(iv2, mns(mlt(s1, s1), s2)));
  }

  printf("%d\n", ans);
  return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define R register int
#define G if(++ip==ie)if(fread(ip=buf,1,SZ,stdin))
using namespace std;
const int SZ=1<<19,N=1<<17,YL=998244353;
char buf[SZ],*ie=buf+SZ,*ip=ie-1;
inline int in(){
	G;while(*ip<'-')G;
	R x=*ip&15;G;
	while(*ip>'-'){x*=10;x+=*ip&15;G;}
	return x;
}
int n,k,m,t,now,ans,fac[N],inv[N],fa[N],s[N],f[N],a[N],b[N],r[N];
vector<int>e[N];
inline bool Cmp(R x,R y){
	return s[x]<s[y];
}
inline LL Pow(LL b,R k=YL-2,LL a=1){
	for(;k;k>>=1,b=b*b%YL)
		if(k&1)a=a*b%YL;
	return a;
}
inline int Mod(R x){
	return x<YL?x:x-YL;
}
void NTT(R*a,R n,R op){
	for(R i=0;i<n;++i)
		if(i<r[i])swap(a[i],a[r[i]]);
	for(R i=1;i<n;i<<=1){
		LL wn=Pow(3,(YL-1)/(i<<1)),w=1,x;
		if(op==-1)wn=Pow(wn);
		for(R j=0;j<n;j+=i<<1,w=1)
			for(R k=j;k<j+i;++k,w=w*wn%YL)
				x=w*a[k+i]%YL,a[k+i]=Mod(a[k]-x+YL),a[k]=Mod(a[k]+x);
	}
	if(op==-1){
		LL x=Pow(n);
		for(R i=0;i<n;++i)a[i]=a[i]*x%YL;
	}
}
void Solve(R x){
	a[0]=1;
	R n=2*e[x].size(),*a=::a+1;
	for(R i=0;i<n;i+=2)
		a[i]=s[e[x][i>>1]];
	for(R i=2;i<n;i<<=1){
		for(R j=1;j<i;++j)
			r[j]=(r[j>>1]>>1)|(1&j?i>>1:0);
		for(R j=0;j+i<n;j+=i<<1){
			R*p=a+j,*q=p+i;
			for(R k=0;k<i;++k)b[k]=Mod(p[k]+q[k]);
			NTT(p,i,1);NTT(q,i,1);
			for(R k=0;k<i;++k)p[k]=(LL)p[k]*q[k]%YL;
			NTT(p,i,-1);
			for(R k=i-1;k;--k)p[k]=Mod(p[k-1]+b[k]);p[0]=b[0];
			memset(q,0,4*i);
		}
	}
}
void Mul(LL x){
	for(R i=m+1;i;--i)
		a[i]=(a[i]+x*a[i-1])%YL;
}
void Div(LL x){
	for(R i=1;i<=m+1;++i)
		a[i]=(a[i]-x*a[i-1]%YL+YL)%YL;
}
int Calc(){
	R n=min(m,k),now=1;
	for(R i=1;i<=n;++i)
		now=(now+(LL)a[i]*fac[k]%YL*inv[k-i])%YL;
	return now;
}
void dfs(R x){
	s[x]=1;
	for(auto y:e[x]){
		e[y].erase(find(e[y].begin(),e[y].end(),x));
		dfs(y),s[x]+=s[y];
		ans=(ans+(LL)f[x]*f[y])%YL,f[x]=Mod(f[x]+f[y]);
	}
	sort(e[x].begin(),e[x].end(),Cmp);
	Solve(x);m=e[x].size();Mul(n-s[x]);
	for(R l=0,r;l<m;l=r){
		Div(t=s[e[x][l]]);now=0;
		for(r=l+1;r<m&&s[e[x][r]]==t;++r);
		for(;l<r;++l)now=Mod(now+f[e[x][l]]);
		ans=(ans+(LL)now*Calc())%YL;
		Mul(t);
	}
	Div(n-s[x]);f[x]=Mod(f[x]+Calc());
	memset(a,0,4*(m+1));
}
int main(){
	n=in(),k=in(),m=max(n,k);
	if(k==1)return cout<<(LL)n*(n-1)/2%YL<<endl,0;
	for(R i=1;i<n;++i){
		R x=in(),y=in();
		e[x].push_back(y);
		e[y].push_back(x);
	}
	fac[0]=1;
	for(R i=1;i<=m;++i)
		fac[i]=(LL)fac[i-1]*i%YL;
	inv[m]=Pow(fac[m]);
	for(R i=m;i;--i)
		inv[i-1]=(LL)inv[i]*i%YL;
	dfs(1);
	cout<<ans<<endl;
	return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define R register int
#define G if(++ip==ie)if(fread(ip=buf,1,SZ,stdin))
#define YL 998244353
using namespace std;
const int SZ=1<<19,N=1e5+9;
char buf[SZ],*ie=buf+SZ,*ip=ie-1;
inline int in(){
	G;while(*ip<'-')G;
	R x=*ip&15;G;
	while(*ip>'-'){x*=10;x+=*ip&15;G;}
	return x;
}
int n,k,m,t,now,ans,fac[N],inv[N],fa[N],s[N],f[N],a[SZ],r[SZ];
vector<int>e[N];
inline bool Cmp(R x,R y){
	return s[x]<s[y];
}
inline LL Pow(LL b,R k=YL-2,LL a=1){
	for(;k;k>>=1,b=b*b%YL)
		if(k&1)a=a*b%YL;
	return a;
}
inline int Mod(R x){
	return x<YL?x:x-YL;
}
void NTT(R*a,R n,R op){
	for(R i=0;i<n;++i)
		if(i<r[i])swap(a[i],a[r[i]]);
	for(R i=1;i<n;i<<=1){
		LL wn=Pow(3,(YL-1)/(i<<1)),w=1,x;
		if(op==-1)wn=Pow(wn);
		for(R j=0;j<n;j+=i<<1,w=1)
			for(R k=j;k<j+i;++k,w=w*wn%YL)
				x=w*a[k+i]%YL,a[k+i]=Mod(a[k]-x+YL),a[k]=Mod(a[k]+x);
	}
	if(op==-1){
		LL x=Pow(n);
		for(R i=0;i<n;++i)a[i]=a[i]*x%YL;
	}
}
void Solve(R x){
	R n=4*e[x].size();
	for(R i=0;i<n;i+=4)
		a[i]=1,a[i+1]=s[e[x][i>>2]];
	for(R i=4;i<n;i<<=1){
		for(R j=1;j<i;++j)
			r[j]=(r[j>>1]>>1)|(1&j?i>>1:0);
		for(R j=0;j+i<n;j+=i<<1){
			R*p=a+j,*q=p+i;
			NTT(p,i,1);NTT(q,i,1);
			for(R k=0;k<i;++k)p[k]=(LL)p[k]*q[k]%YL;
			NTT(p,i,-1);
			memset(q,0,4*i);
		}
	}
}
void Mul(LL x){
	for(R i=m+1;i;--i)
		a[i]=(a[i]+x*a[i-1])%YL;
}
void Div(LL x){
	for(R i=1;i<=m+1;++i)
		a[i]=(a[i]-x*a[i-1]%YL+YL)%YL;
}
int Calc(){
	R n=min(m,k),now=1;
	for(R i=1;i<=n;++i)
		now=(now+(LL)a[i]*fac[k]%YL*inv[k-i])%YL;
	return now;
}
void dfs(R x){
	s[x]=1;
	for(auto y:e[x]){
		e[y].erase(find(e[y].begin(),e[y].end(),x));
		dfs(y),s[x]+=s[y];
		ans=(ans+(LL)f[x]*f[y])%YL,f[x]=Mod(f[x]+f[y]);
	}
	sort(e[x].begin(),e[x].end(),Cmp);
	Solve(x);m=e[x].size();Mul(n-s[x]);
	for(R l=0,r;l<m;l=r){
		Div(t=s[e[x][l]]);now=0;
		for(r=l+1;r<m&&s[e[x][r]]==t;++r);
		for(;l<r;++l)now=Mod(now+f[e[x][l]]);
		ans=(ans+(LL)now*Calc())%YL;
		Mul(t);
	}
	Div(n-s[x]);f[x]=Mod(f[x]+Calc());
	memset(a,0,4*(m+1));
}
int main(){
	n=in(),k=in(),m=max(n,k);
	if(k==1)return cout<<(LL)n*(n-1)/2%YL<<endl,0;
	for(R i=1;i<n;++i){
		R x=in(),y=in();
		e[x].push_back(y);
		e[y].push_back(x);
	}
	fac[0]=1;
	for(R i=1;i<=m;++i)
		fac[i]=(LL)fac[i-1]*i%YL;
	inv[m]=Pow(fac[m]);
	for(R i=m;i;--i)
		inv[i-1]=(LL)inv[i]*i%YL;
	dfs(1);
	cout<<ans<<endl;
	return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define R register int
#define G if(++ip==ie)if(fread(ip=buf,1,SZ,stdin))
#define YL 998244353
using namespace std;
const int SZ=1<<19,N=1<<18;
char buf[SZ],*ie=buf+SZ,*ip=ie-1;
inline int in(){
    G;while(*ip<'-')G;
    R x=*ip&15;G;
    while(*ip>'-'){x*=10;x+=*ip&15;G;}
    return x;
}
int n,k,m,t,now,ans,fac[N],inv[N],fa[N],s[N],f[N],a[N],b[N],r[N];
vector<int>e[N];
inline bool Cmp(R x,R y){
    return s[x]<s[y];
}
inline LL Pow(LL b,R k=YL-2,LL a=1){
    for(;k;k>>=1,b=b*b%YL)
        if(k&1)a=a*b%YL;
    return a;
}
inline int Mod(R x){
    return x<YL?x:x-YL;
}
void NTT(R*a,R n,R op){
    for(R i=0;i<n;++i)
        if(i<r[i])swap(a[i],a[r[i]]);
    for(R i=1;i<n;i<<=1){
        LL wn=Pow(3,(YL-1)/(i<<1)),w=1,x;
        if(op==-1)wn=Pow(wn);
        for(R j=0;j<n;j+=i<<1,w=1)
            for(R k=j;k<j+i;++k,w=w*wn%YL)
                x=w*a[k+i]%YL,a[k+i]=Mod(a[k]-x+YL),a[k]=Mod(a[k]+x);
    }
    if(op==-1){
        LL x=Pow(n);
        for(R i=0;i<n;++i)a[i]=a[i]*x%YL;
    }
}
void Solve(R x){
    a[0]=1;
    R n=2*e[x].size(),*a=::a+1;
    for(R i=0;i<n;i+=2)
        a[i]=s[e[x][i>>1]];
    for(R i=2;i<n;i<<=1){
        for(R j=1;j<i;++j)
            r[j]=(r[j>>1]>>1)|(1&j?i>>1:0);
        for(R j=0;j+i<n;j+=i<<1){
            R*p=a+j,*q=p+i;
            for(R k=0;k<i;++k)b[k]=Mod(p[k]+q[k]);
            NTT(p,i,1);NTT(q,i,1);
            for(R k=0;k<i;++k)p[k]=(LL)p[k]*q[k]%YL;
            NTT(p,i,-1);
            for(R k=i-1;k;--k)p[k]=Mod(p[k-1]+b[k]);p[0]=b[0];
            memset(q,0,4*i);
        }
    }
}
void Mul(LL x){
    for(R i=m+1;i;--i)
        a[i]=(a[i]+x*a[i-1])%YL;
}
void Div(LL x){
    for(R i=1;i<=m+1;++i)
        a[i]=(a[i]-x*a[i-1]%YL+YL)%YL;
}
int Calc(){
    R n=min(m,k),now=1;
    for(R i=1;i<=n;++i)
        now=(now+(LL)a[i]*fac[k]%YL*inv[k-i])%YL;
    return now;
}
void dfs(R x){
    s[x]=1;
    for(auto y:e[x]){
        e[y].erase(find(e[y].begin(),e[y].end(),x));
        dfs(y),s[x]+=s[y];
        ans=(ans+(LL)f[x]*f[y])%YL,f[x]=Mod(f[x]+f[y]);
    }
    sort(e[x].begin(),e[x].end(),Cmp);
    Solve(x);m=e[x].size();Mul(n-s[x]);
    for(R l=0,r;l<m;l=r){
        Div(t=s[e[x][l]]);now=0;
        for(r=l+1;r<m&&s[e[x][r]]==t;++r);
        for(;l<r;++l)now=Mod(now+f[e[x][l]]);
        ans=(ans+(LL)now*Calc())%YL;
        Mul(t);
    }
    Div(n-s[x]);f[x]=Mod(f[x]+Calc());
    memset(a,0,4*(m+1));
}
int main(){
    n=in(),k=in(),m=max(n,k);
    if(k==1)return cout<<(LL)n*(n-1)/2%YL<<endl,0;
    for(R i=1;i<n;++i){
        R x=in(),y=in();
        e[x].push_back(y);
        e[y].push_back(x);
    }
    fac[0]=1;
    for(R i=1;i<=m;++i)
        fac[i]=(LL)fac[i-1]*i%YL;
    inv[m]=Pow(fac[m]);
    for(R i=m;i;--i)
        inv[i-1]=(LL)inv[i]*i%YL;
    dfs(1);
    cout<<ans<<endl;
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define R register int
#define G if(++ip==ie)if(fread(ip=buf,1,SZ,stdin))
using namespace std;
const int SZ=1<<19,N=1<<18,YL=998244353;
char buf[SZ],*ie=buf+SZ,*ip=ie-1;
inline int in(){
	G;while(*ip<'-')G;
	R x=*ip&15;G;
	while(*ip>'-'){x*=10;x+=*ip&15;G;}
	return x;
}
int n,k,m,t,now,ans,fac[N],inv[N],fa[N],s[N],f[N],a[N],b[N],r[N];
vector<int>e[N];
inline bool Cmp(R x,R y){
	return s[x]<s[y];
}
inline LL Pow(LL b,R k=YL-2,LL a=1){
	for(;k;k>>=1,b=b*b%YL)
		if(k&1)a=a*b%YL;
	return a;
}
inline int Mod(R x){
	return x<YL?x:x-YL;
}
void NTT(R*a,R n,R op){
	for(R i=0;i<n;++i)
		if(i<r[i])swap(a[i],a[r[i]]);
	for(R i=1;i<n;i<<=1){
		LL wn=Pow(3,(YL-1)/(i<<1)),w=1,x;
		if(op==-1)wn=Pow(wn);
		for(R j=0;j<n;j+=i<<1,w=1)
			for(R k=j;k<j+i;++k,w=w*wn%YL)
				x=w*a[k+i]%YL,a[k+i]=Mod(a[k]-x+YL),a[k]=Mod(a[k]+x);
	}
	if(op==-1){
		LL x=Pow(n);
		for(R i=0;i<n;++i)a[i]=a[i]*x%YL;
	}
}
void Solve(R x){
	a[0]=1;
	R n=2*e[x].size(),*a=::a+1;
	for(R i=0;i<n;i+=2)
		a[i]=s[e[x][i>>1]];
	for(R i=2;i<n;i<<=1){
		for(R j=1;j<i;++j)
			r[j]=(r[j>>1]>>1)|(1&j?i>>1:0);
		for(R j=0;j+i<n;j+=i<<1){
			R*p=a+j,*q=p+i;
			for(R k=0;k<i;++k)b[k]=Mod(p[k]+q[k]);
			NTT(p,i,1);NTT(q,i,1);
			for(R k=0;k<i;++k)p[k]=(LL)p[k]*q[k]%YL;
			NTT(p,i,-1);
			for(R k=i-1;k;--k)p[k]=Mod(p[k-1]+b[k]);p[0]=b[0];
			memset(q,0,4*i);
		}
	}
}
void Mul(LL x){
	for(R i=m+1;i;--i)
		a[i]=(a[i]+x*a[i-1])%YL;
}
void Div(LL x){
	for(R i=1;i<=m+1;++i)
		a[i]=(a[i]-x*a[i-1]%YL+YL)%YL;
}
int Calc(){
	R n=min(m,k),now=1;
	for(R i=1;i<=n;++i)
		now=(now+(LL)a[i]*fac[k]%YL*inv[k-i])%YL;
	return now;
}
void dfs(R x){
	s[x]=1;
	for(auto y:e[x]){
		e[y].erase(find(e[y].begin(),e[y].end(),x));
		dfs(y),s[x]+=s[y];
		ans=(ans+(LL)f[x]*f[y])%YL,f[x]=Mod(f[x]+f[y]);
	}
	sort(e[x].begin(),e[x].end(),Cmp);
	Solve(x);m=e[x].size();Mul(n-s[x]);
	for(R l=0,r;l<m;l=r){
		Div(t=s[e[x][l]]);now=0;
		for(r=l+1;r<m&&s[e[x][r]]==t;++r);
		for(;l<r;++l)now=Mod(now+f[e[x][l]]);
		ans=(ans+(LL)now*Calc())%YL;
		Mul(t);
	}
	Div(n-s[x]);f[x]=Mod(f[x]+Calc());
	memset(a,0,4*(m+1));
}
int main(){
	n=in(),k=in(),m=max(n,k);
	if(k==1)return cout<<(LL)n*(n-1)/2%YL<<endl,0;
	for(R i=1;i<n;++i){
		R x=in(),y=in();
		e[x].push_back(y);
		e[y].push_back(x);
	}
	fac[0]=1;
	for(R i=1;i<=m;++i)
		fac[i]=(LL)fac[i-1]*i%YL;
	inv[m]=Pow(fac[m]);
	for(R i=m;i;--i)
		inv[i-1]=(LL)inv[i]*i%YL;
	dfs(1);
	cout<<ans<<endl;
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define rg register
using namespace std;
const int MAXN=53e4+10;
const int Mod=998244353;
struct gao{   int u,v,Next;   }Edge[MAXN<<1];
int n,K,Ls,Ans,Es,First[MAXN],Help[MAXN],Dp[MAXN],Inv[MAXN];
int F1[MAXN],St[MAXN],Sons[MAXN],Tot[MAXN],Fac[MAXN]={1},Invf[MAXN];
vector<int>Son[MAXN];
inline int Read()
{   rg int a=0,c=1;   rg char b=getchar();
	while(b!='-'&&(b<'0'||b>'9'))b=getchar();
	if(b=='-')c=-1,b=getchar();
	while(b>='0'&&b<='9')a=a*10+b-48,b=getchar();
	return a*c;
}
inline int Fast(rg int Di,rg int Mi)
{   rg int Back=1;
	for(;Mi>=1;Mi>>=1,Di=1ll*Di*Di%Mod)
		if(Mi&1) Back=1ll*Back*Di%Mod;
	return Back;
}
inline int Max(rg int A,rg int B){   return A>B?A:B;   }
inline int cmp(rg int A,rg int B){   return Tot[A]<Tot[B];   }
inline int Add(rg int A,rg int B){   return A+=B,A-=A>=Mod?Mod:0,A;   }
inline int C(rg int A,rg int B){   return A<B?0:1ll*Fac[A]*Invf[B]%Mod*Invf[A-B]%Mod;   }
inline void Link(rg int u,rg int v){   Edge[++Es]=(gao){u,v,First[u]},First[u]=Es;   }
namespace Poly
{   int Rader[MAXN],A[MAXN],B[MAXN],W[MAXN],Len,Ms,Invl;
	int H[20][MAXN];
	inline void NTT(int *P,rg int opt)
	{   for(rg int i=0;i<Len;i++)
			if(i<Rader[i]) swap(P[i],P[Rader[i]]);
		for(rg int i=1;i<Len;i<<=1)
		{   rg int Euler=Fast(3,(Mod-1)/(i<<1));
			if(opt<0) Euler=Fast(Euler,Mod-2);
			for(rg int k=0,Wi=1;k<i;k++,Wi=1ll*Wi*Euler%Mod) W[k]=Wi;
			for(rg int Pos=i<<1,j=0;j<Len;j+=Pos)
				for(rg int k=0,X,Y;k<i;k++)
					X=P[j+k],Y=1ll*W[k]*P[i+j+k]%Mod,P[j+k]=Add(X,Y),P[i+j+k]=Add(X,Mod-Y);
		}
		if(opt>0) return ;   Invl=Fast(Len,Mod-2);
		for(rg int i=0;i<Len;i++) P[i]=1ll*P[i]*Invl%Mod;
	}
	inline void Prepare(rg int Lx)
	{   Ms=-1;
		for(Len=1;Len<Lx;Len<<=1) Ms++;
		for(rg int i=0;i<Len;i++) Rader[i]=(Rader[i>>1]>>1)|((i&1)<<Ms);
	}
	inline void Get_Mul(int *X,int *Y,int *Z,rg int Lx)
	{   Prepare(Lx<<1);
		for(rg int i=0;i<Lx;i++) A[i]=X[i],B[i]=Y[i];
		for(rg int i=Lx;i<Len;i++) A[i]=B[i]=0;
		NTT(A,1),NTT(B,1);
		for(rg int i=0;i<Len;i++) A[i]=1ll*A[i]*B[i]%Mod;
		NTT(A,-1);
		for(rg int i=0;i<Len;i++) Z[i]=A[i];
	}
	inline int Get_Div(rg int D,rg int Le,rg int Ri)
	{   if(Le==Ri) return H[D][0]=1,H[D][1]=Help[Le],1;
		rg int Mid=(Le+Ri)>>1,Ll=Get_Div(D+1,Le,Mid),Rl=0;
		for(rg int i=0;i<=Ll;i++) H[D][i]=H[D+1][i],H[D+1][i]=0;
		Rl=Get_Div(D+1,Mid+1,Ri),Get_Mul(H[D],H[D+1],H[D],Max(Ll,Rl)+1);
		return Ll+Rl;
	}
	inline void Multiply(int *X,int *Y,rg int Tot,rg int Lx)
	{   X[Lx]=0,A[0]=X[0];
		for(rg int i=1;i<=Lx;i++) A[i]=(X[i]+1ll*Tot*X[i-1])%Mod;
		for(rg int i=0;i<=Lx;i++) Y[i]=A[i];
	}
	inline void Divide(int *X,int *Y,rg int Tot,rg int Lx)
	{   for(rg int i=0;i<Lx;i++) A[i]=X[i];
		for(rg int i=Lx-2;i>=0;i--) Y[i]=1ll*A[i+1]*Inv[Tot]%Mod,A[i]=(A[i]+Mod-Y[i])%Mod;
	}
}using Poly::Divide;using Poly::Multiply;using Poly::Get_Div;using Poly::Get_Mul;using Poly::H;
inline int Calc(rg int Now,rg int Tv)
{   rg int Back=0;
	for(rg int i=0,j=St[Now];i<=Sons[Now];i++,j++) Help[i]=F1[j];
	Divide(Help,Help,Tv,Sons[Now]+1),Multiply(Help,Help,n-Tot[Now],Sons[Now]);
	for(rg int i=0;i<=Sons[Now];i++) Back=(Back+1ll*Help[i]*C(K,i)%Mod*Fac[i])%Mod;
	return Back;
}
inline void Dfs1(rg int Now,rg int Ba)
{   for(rg int i=First[Now],v,j=1;i!=-1;i=Edge[i].Next)
		if((v=Edge[i].v)!=Ba) Dfs1(v,Now),Sons[Now]++,Tot[Now]+=Tot[v],Help[j++]=Tot[v];
	Tot[Now]++,St[Now]=Ls+1,Sons[Now]?Get_Div(1,1,Sons[Now]):H[1][0]=1;
	for(rg int i=0;i<=Sons[Now];i++) F1[++Ls]=H[1][i];
}
inline void Dfs2(rg int Now,rg int Ba)
{   Help[Now]=0;
	for(rg int i=First[Now],v;i!=-1;i=Edge[i].Next)
		if((v=Edge[i].v)!=Ba) Dfs2(v,Now),Help[Now]=Add(Help[Now],Help[v]),Son[Now].push_back(v);
	for(rg int i=First[Now],v;i!=-1;i=Edge[i].Next)
		if((v=Edge[i].v)!=Ba) Ans=(Ans+1ll*Help[v]*(Help[Now]-Help[v]))%Mod;
	Help[Now]=Add(Help[Now],Dp[Now]);
}
inline void Dfs3(rg int Now,rg int Ba,rg int Sum)
{   sort(Son[Now].begin(),Son[Now].end(),cmp),Ans=(Ans+1ll*Sum*Dp[Now])%Mod;
	for(rg int i=0,Endi=Son[Now].size(),Ns;i<Endi;i++)
		Ns=!i||Tot[Son[Now][i]]!=Tot[Son[Now][i-1]]?Calc(Now,Tot[Son[Now][i]]):Ns,Dfs3(Son[Now][i],Now,Add(Sum,Ns));
}
int main()
{   n=Read(),K=Read();
	memset(First,-1,sizeof(First));
	if(K==1) return printf("%I64d\n",1ll*n*(n-1)/2%Mod),0;
	for(rg int i=1,u,v;i<n;i++) u=Read(),v=Read(),Link(u,v),Link(v,u);
	for(rg int i=0;i<=n;i++) Inv[i]=Fast(i,Mod-2);
	for(rg int i=1;i<=K;i++) Fac[i]=1ll*Fac[i-1]*i%Mod;
	Dfs1(1,1),Invf[K]=Fast(Fac[K],Mod-2);
	for(rg int i=K-1;i>=0;i--) Invf[i]=1ll*Invf[i+1]*(i+1)%Mod;
	for(rg int i=1;i<=n;i++)
		for(rg int j=0;j<=Sons[i];j++) Dp[i]=(Dp[i]+1ll*F1[St[i]+j]*C(K,j)%Mod*Fac[j])%Mod;
	Dfs2(1,1),Ans=1ll*Ans*Fast(2,Mod-2)%Mod,Dfs3(1,1,0),printf("%d\n",Add(Ans,Mod));
}


#include<bits/stdc++.h>
#define ll long long
#define rg register
using namespace std;
const int MAXN=53e4+10;
const int Mod=998244353;
struct gao{   int u,v,Next;   }Edge[MAXN<<1];
int n,K,Ls,Ans,Es,First[MAXN],Help[MAXN],Dp[MAXN],Inv[MAXN];
int F1[MAXN],St[MAXN],Sons[MAXN],Tot[MAXN],Fac[MAXN]={1},Invf[MAXN];
vector<int>Son[MAXN];
inline int Read()
{   rg int a=0,c=1;   rg char b=getchar();
    while(b!='-'&&(b<'0'||b>'9'))b=getchar();
    if(b=='-')c=-1,b=getchar();
    while(b>='0'&&b<='9')a=a*10+b-48,b=getchar();
    return a*c;
}
inline int Fast(rg int Di,rg int Mi)
{   rg int Back=1;
    for(;Mi>=1;Mi>>=1,Di=1ll*Di*Di%Mod)
        if(Mi&1) Back=1ll*Back*Di%Mod;
    return Back;
}
inline int Max(rg int A,rg int B){   return A>B?A:B;   }
inline int cmp(rg int A,rg int B){   return Tot[A]<Tot[B];   }
inline int Add(rg int A,rg int B){   return A+=B,A-=A>=Mod?Mod:0,A;   }
inline int C(rg int A,rg int B){   return A<B?0:1ll*Fac[A]*Invf[B]%Mod*Invf[A-B]%Mod;   }
inline void Link(rg int u,rg int v){   Edge[++Es]=(gao){u,v,First[u]},First[u]=Es;   }
namespace Poly
{   int Rader[MAXN],A[MAXN],B[MAXN],W[MAXN],Len,Ms,Invl;
    int H[20][MAXN];
    inline void NTT(int *P,rg int opt)
    {   for(rg int i=0;i<Len;i++)
            if(i<Rader[i]) swap(P[i],P[Rader[i]]);
        for(rg int i=1;i<Len;i<<=1)
        {   rg int Euler=Fast(3,(Mod-1)/(i<<1));
            if(opt<0) Euler=Fast(Euler,Mod-2);
            for(rg int k=0,Wi=1;k<i;k++,Wi=1ll*Wi*Euler%Mod) W[k]=Wi;
            for(rg int Pos=i<<1,j=0;j<Len;j+=Pos)
                for(rg int k=0,X,Y;k<i;k++)
                    X=P[j+k],Y=1ll*W[k]*P[i+j+k]%Mod,P[j+k]=Add(X,Y),P[i+j+k]=Add(X,Mod-Y);
        }
        if(opt>0) return ;   Invl=Fast(Len,Mod-2);
        for(rg int i=0;i<Len;i++) P[i]=1ll*P[i]*Invl%Mod;
    }
    inline void Prepare(rg int Lx)
    {   Ms=-1;
        for(Len=1;Len<Lx;Len<<=1) Ms++;
        for(rg int i=0;i<Len;i++) Rader[i]=(Rader[i>>1]>>1)|((i&1)<<Ms);
    }
    inline void Get_Mul(int *X,int *Y,int *Z,rg int Lx)
    {   Prepare(Lx<<1);
        for(rg int i=0;i<Lx;i++) A[i]=X[i],B[i]=Y[i];
        for(rg int i=Lx;i<Len;i++) A[i]=B[i]=0;
        NTT(A,1),NTT(B,1);
        for(rg int i=0;i<Len;i++) A[i]=1ll*A[i]*B[i]%Mod;
        NTT(A,-1);
        for(rg int i=0;i<Len;i++) Z[i]=A[i];
    }
    inline int Get_Div(rg int D,rg int Le,rg int Ri)
    {   if(Le==Ri) return H[D][0]=1,H[D][1]=Help[Le],1;
        rg int Mid=(Le+Ri)>>1,Ll=Get_Div(D+1,Le,Mid),Rl=0;
        for(rg int i=0;i<=Ll;i++) H[D][i]=H[D+1][i],H[D+1][i]=0;
        Rl=Get_Div(D+1,Mid+1,Ri),Get_Mul(H[D],H[D+1],H[D],Max(Ll,Rl)+1);
        return Ll+Rl;
    }
    inline void Multiply(int *X,int *Y,rg int Tot,rg int Lx)
    {   X[Lx]=0,A[0]=X[0];
        for(rg int i=1;i<=Lx;i++) A[i]=(X[i]+1ll*Tot*X[i-1])%Mod;
        for(rg int i=0;i<=Lx;i++) Y[i]=A[i];
    }
    inline void Divide(int *X,int *Y,rg int Tot,rg int Lx)
    {   for(rg int i=0;i<Lx;i++) A[i]=X[i];
        for(rg int i=Lx-2;i>=0;i--) Y[i]=1ll*A[i+1]*Inv[Tot]%Mod,A[i]=(A[i]+Mod-Y[i])%Mod;
    }
}using Poly::Divide;using Poly::Multiply;using Poly::Get_Div;using Poly::Get_Mul;using Poly::H;
inline int Calc(rg int Now,rg int Tv)
{   rg int Back=0;
    for(rg int i=0,j=St[Now];i<=Sons[Now];i++,j++) Help[i]=F1[j];
    Divide(Help,Help,Tv,Sons[Now]+1),Multiply(Help,Help,n-Tot[Now],Sons[Now]);
    for(rg int i=0;i<=Sons[Now];i++) Back=(Back+1ll*Help[i]*C(K,i)%Mod*Fac[i])%Mod;
    return Back;
}
inline void Dfs1(rg int Now,rg int Ba)
{   for(rg int i=First[Now],v,j=1;i!=-1;i=Edge[i].Next)
        if((v=Edge[i].v)!=Ba)   Dfs1(v,Now),Sons[Now]++,Tot[Now]+=Tot[v];
    for(rg int i=First[Now],j=1;i!=-1;i=Edge[i].Next)
        if(Edge[i].v!=Ba) Help[j++]=Tot[Edge[i].v];
    Tot[Now]++,St[Now]=Ls+1,Sons[Now]?Get_Div(1,1,Sons[Now]):H[1][0]=1;
    for(rg int i=0;i<=Sons[Now];i++) F1[++Ls]=H[1][i];
}
inline void Dfs2(rg int Now,rg int Ba)
{   Help[Now]=0;
    for(rg int i=First[Now],v;i!=-1;i=Edge[i].Next)
        if((v=Edge[i].v)!=Ba) Dfs2(v,Now),Help[Now]=Add(Help[Now],Help[v]),Son[Now].push_back(v);
    for(rg int i=First[Now],v;i!=-1;i=Edge[i].Next)
        if((v=Edge[i].v)!=Ba) Ans=(Ans+1ll*Help[v]*(Help[Now]-Help[v]))%Mod;
    Help[Now]=Add(Help[Now],Dp[Now]);
}
inline void Dfs3(rg int Now,rg int Ba,rg int Sum)
{   sort(Son[Now].begin(),Son[Now].end(),cmp),Ans=(Ans+1ll*Sum*Dp[Now])%Mod;
    for(rg int i=0,Endi=Son[Now].size(),Ns;i<Endi;i++)
        Ns=!i||Tot[Son[Now][i]]!=Tot[Son[Now][i-1]]?Calc(Now,Tot[Son[Now][i]]):Ns,Dfs3(Son[Now][i],Now,Add(Sum,Ns));
}
int main()
{   n=Read(),K=Read();
    memset(First,-1,sizeof(First));
    if(K==1) return printf("%I64d\n",1ll*n*(n-1)/2%Mod),0;
    for(rg int i=1,u,v;i<n;i++) u=Read(),v=Read(),Link(u,v),Link(v,u);
    for(rg int i=0;i<=n;i++) Inv[i]=Fast(i,Mod-2);
    for(rg int i=1;i<=K;i++) Fac[i]=1ll*Fac[i-1]*i%Mod;
    Dfs1(1,1),Invf[K]=Fast(Fac[K],Mod-2);
    for(rg int i=K-1;i>=0;i--) Invf[i]=1ll*Invf[i+1]*(i+1)%Mod;
    for(rg int i=1;i<=n;i++)
        for(rg int j=0;j<=Sons[i];j++) Dp[i]=(Dp[i]+1ll*F1[St[i]+j]*C(K,j)%Mod*Fac[j])%Mod;
    Dfs2(1,1),Ans=1ll*Ans*Fast(2,Mod-2)%Mod,Dfs3(1,1,0),printf("%d\n",Add(Ans,Mod));
}


#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <list>
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;

#define PB push_back
#define MP make_pair
#define SZ(v) ((int)(v).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n) FORE(i,0,n)
#define FORSZ(i,a,v) FOR(i,a,SZ(v))
#define REPSZ(i,v) REP(i,SZ(v))
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=100000;
const int MAXPATH=100000;
const int MOD=998244353;

int n,npath;
vector<int> adj[MAXN];

int fac[MAXPATH+1];
int inv[MAXPATH+1];
int ifac[MAXPATH+1];

int sz[MAXN];
int waysdown[MAXN]; // # ways for this subtree when the incoming edge occurs in all paths
int waysup[MAXN]; // # ways for everything except this subtree when the incoming edge occurs in all paths

void dfsinit(int at,int par) {
	sz[at]=1;
	REPSZ(i,adj[at]) {
		int to=adj[at][i]; if(to==par) continue;
		dfsinit(to,at);
		sz[at]+=sz[to];
	}
}

pair<int,int> opt[MAXN]; int nopt;

struct Pol { vector<int> coef; };

Pol pol[MAXN];
Pol pref[MAXN+1];
Pol suff[MAXN+1];

Pol pmult(const Pol &a,const Pol &b) {
	Pol ret; ret.coef=vector<int>(SZ(a.coef)+SZ(b.coef)-1,0);
	//printf("a:"); REPSZ(i,a.coef) printf(" %d",a.coef[i]); puts("");
	//printf("b:"); REPSZ(i,b.coef) printf(" %d",b.coef[i]); puts("");
	REPSZ(i,a.coef) REPSZ(j,b.coef) ret.coef[i+j]=(ret.coef[i+j]+(ll)a.coef[i]*b.coef[j])%MOD;
	//printf("ret:"); REPSZ(i,ret.coef) printf(" %d",ret.coef[i]); puts("");
	return ret;
}

void dfsways(int at,int par) {
	nopt=0;
	if(par!=-1) opt[nopt++]=MP(n-sz[at],par),waysdown[at]=0;
	REPSZ(i,adj[at]) {
		int to=adj[at][i]; if(to==par) continue;
		opt[nopt++]=MP(sz[to],to);
		waysup[to]=0;
	}
	sort(opt,opt+nopt);

	REP(i,nopt) { pol[i].coef.clear(); pol[i].coef.PB(1); pol[i].coef.PB(opt[i].first); }
	pref[0].coef.clear(); pref[0].coef.PB(1); REP(i,nopt) pref[i+1]=pmult(pref[i],pol[i]);
	suff[nopt].coef.clear(); suff[nopt].coef.PB(1); for(int i=nopt-1;i>=0;--i) suff[i]=pmult(suff[i+1],pol[i]);
	REP(j,nopt) {
		Pol cur=pmult(pref[j],suff[j+1]);
		int ways=0;
		REPSZ(k,cur.coef) if(k<=npath) {
			ways=(ways+(ll)cur.coef[k]*fac[npath]%MOD*ifac[npath-k])%MOD;
		}
		if(opt[j].second==par) waysdown[at]=(waysdown[at]+ways)%MOD; else waysup[opt[j].second]=(waysup[opt[j].second]+ways)%MOD;
	}

	/*//printf("at %d -> opt:",at+1); REP(j,nopt) printf(" %d=%d",opt[j].second+1,opt[j].first); puts("");
	REP(i,1<<nopt) {
		int cnt=0,prod=1;
		REP(j,nopt) if(i&(1<<j)) ++cnt,prod=(ll)prod*opt[j].first%MOD;
		if(cnt>npath) continue;
		int ways=(ll)prod*fac[npath]%MOD*ifac[npath-cnt]%MOD;
		//printf("\t%x -> %d\n",i,ways);
		REP(j,nopt) if((i&(1<<j))==0) if(opt[j].second==par) waysdown[at]=(waysdown[at]+ways)%MOD; else waysup[opt[j].second]=(waysup[opt[j].second]+ways)%MOD;
	}
	//if(par!=-1) printf("waysdown[%d]=%d\n",at+1,waysdown[at]);
	//REP(j,nopt) if(opt[j].second!=par) printf("waysup[%d]=%d\n",opt[j].second+1,waysup[opt[j].second]); */

	REPSZ(i,adj[at]) {
		int to=adj[at][i]; if(to==par) continue;
		dfsways(to,at);
		waysdown[at]=(waysdown[at]+waysdown[to])%MOD;
	}
}

int dfscalc(int at,int par) { // #ways when there is at least one edge that occurs in all paths in this subtree, and not in any other part
	int ret=0;
	// no adjacent edge in all paths
	REPSZ(i,adj[at]) {
		int to=adj[at][i]; if(to==par) continue;
		ret=(ret+dfscalc(to,at))%MOD;
	}
	// one adjacent edge in all paths
	REPSZ(i,adj[at]) {
		int to=adj[at][i]; if(to==par) continue;
		//printf("\t%d->%d: %d*%d\n",at+1,to+1,waysup[to],waysdown[to]);
		ret=(ret+(ll)waysup[to]*waysdown[to])%MOD;
	}
	// two adjacent edges in all paths
	int sum=0;
	REPSZ(i,adj[at]) {
		int to=adj[at][i]; if(to==par) continue;
		ret=(ret+(ll)sum*waysdown[to])%MOD;
		sum=(sum+waysdown[to])%MOD;
	}
	//printf("dfscalc(%d)=%d\n",at+1,ret);
	return ret;
}

int solve() {
	if(npath==1) return (ll)n*(n-1)/2%MOD;

	inv[1]=1; FORE(i,2,npath) inv[i]=(ll)(MOD-MOD/i)*inv[MOD%i]%MOD;
	fac[0]=1; FORE(i,1,npath) fac[i]=(ll)fac[i-1]*i%MOD;
	ifac[0]=1; FORE(i,1,npath) ifac[i]=(ll)ifac[i-1]*inv[i]%MOD;

	dfsinit(0,-1);
	dfsways(0,-1);
	return dfscalc(0,-1);
}

void run() {
	scanf("%d%d",&n,&npath); REP(i,n-1) { int a,b; scanf("%d%d",&a,&b); --a,--b; adj[a].PB(b),adj[b].PB(a); }
	printf("%d\n",solve());
}

int main() {
	run();
	return 0;
}


#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <list>
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;

#define PB push_back
#define MP make_pair
#define SZ(v) ((int)(v).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n) FORE(i,0,n)
#define FORSZ(i,a,v) FOR(i,a,SZ(v))
#define REPSZ(i,v) REP(i,SZ(v))
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=100000;
const int MAXPATH=100000;
const int MOD=998244353;
const int PRIMROOT=3;
int pw(int x,int n) { int ret=1; while(true) { if(n&1) ret=(ll)ret*x%MOD; if((n>>=1)==0) return ret; x=(ll)x*x%MOD; } }

struct NTT {
	void _init(int n,int &nlog,int &g,vector<int> &w) {
		assert((MOD - 1) % n == 0);
		g = pw(PRIMROOT, (MOD - 1) / n); nlog = 0; while ((1 << nlog) < n) ++nlog; if ((1 << nlog) != n) nlog = -1;
		w = vector<int>(n); w[0] = 1; FOR(i, 1, n) w[i] = (ll)w[i - 1]*g%MOD;
	}
	int fftn, fftnlog; int fftg; vector<int> fftw;
	void initfft(int n) { fftn = n, _init(fftn, fftnlog, fftg, fftw); assert(fftnlog != -1); }
	void fft(int *a, int n, bool inv) {
		if (n != fftn) initfft(n);
		for (int i = 1, j = n >> 1, k, l = j; i < n; j ^= k, ++i) { if (i < j) swap(a[i], a[j]); for (k = l; k&j; j ^= k, k >>= 1); }
		int *l, *r, *w;
		if (inv) reverse(fftw.begin() + 1, fftw.end());
		for (int hlen = 1, step = n >> 1; hlen < n; hlen <<= 1, step >>= 1) {
			for (int i = 0; i < n; i += (hlen << 1)) {
				l = a + i, r = l + hlen, w = fftw.data();
				REP(off, hlen) {
					int v = (ll)(*r)*(*w)%MOD;
					*r = (*l)-v; if(*r<0) *r+=MOD;
					*l = (*l)+v; if(*l>=MOD) *l-=MOD;
					++l, ++r, w += step;
				}
			}
		}
		if (inv) reverse(fftw.begin() + 1, fftw.end());
		if (inv) { int mlt = pw(n, MOD - 2); REP(i, n) a[i] = (ll)a[i]*mlt%MOD; }
	}
	void mult(int *a,int na,int *b,int nb,int *c,int nc) {
		int sz=1; while(sz<na+nb-1) sz*=2;
		vector<int> A(sz,0),B(sz,0);
		REP(i,na) A[i]=a[i]; REP(i,nb) B[i]=b[i];
		fft(A.data(),sz,false); fft(B.data(),sz,false); REP(i,sz) A[i]=(ll)A[i]*B[i]%MOD; fft(A.data(),sz,true);
		REP(i,nc) c[i]=i<sz?A[i]:0;
	}
};

int n,npath;
vector<int> adj[MAXN];

int fac[MAXPATH+1];
int inv[MAXPATH+1];
int ifac[MAXPATH+1];

int sz[MAXN];
int waysdown[MAXN]; // # ways for this subtree when the incoming edge occurs in all paths
int waysup[MAXN]; // # ways for everything except this subtree when the incoming edge occurs in all paths

void dfsinit(int at,int par) {
	sz[at]=1;
	REPSZ(i,adj[at]) {
		int to=adj[at][i]; if(to==par) continue;
		dfsinit(to,at);
		sz[at]+=sz[to];
	}
}

pair<int,int> opt[MAXN]; int nopt;

//struct Pol { vector<int> coef; };
typedef vector<int> Pol;
NTT ntt;

Pol rec(int l,int r) {
	if(l==r) { Pol ret; ret.PB(1); ret.PB(opt[l].first); return ret; }
	int m=l+(r-l)/2;
	Pol a=rec(l,m),b=rec(m+1,r);
	Pol c; c.resize(SZ(a)+SZ(b)-1); ntt.mult(a.data(),SZ(a),b.data(),SZ(b),c.data(),SZ(c)); return c;
}

void dfsways(int at,int par) {
	nopt=0;
	if(par!=-1) opt[nopt++]=MP(n-sz[at],par);
	REPSZ(i,adj[at]) {
		int to=adj[at][i]; if(to==par) continue;
		opt[nopt++]=MP(sz[to],to);
	}
	sort(opt,opt+nopt);
	Pol pol=rec(0,nopt-1); assert(SZ(pol)==nopt+1);
	int ways=-1;
	REP(i,nopt) {
		if(i==0||opt[i-1].first!=opt[i].first) {
			int a=opt[i].first,ainv=pw(a,MOD-2);
			// pol/(a*x+1)
			Pol cpol(nopt,0); int carry=pol[nopt];
			for(int i=nopt-1;i>=0;--i) {
				cpol[i]=(ll)carry*ainv%MOD;
				carry=(pol[i]+MOD-cpol[i])%MOD;
			}
			assert(carry==0);
			ways=0; REPSZ(k,cpol) if(k<=npath) ways=(ways+(ll)cpol[k]*fac[npath]%MOD*ifac[npath-k])%MOD;
		}
		if(opt[i].second==par) waysdown[at]=ways; else waysup[opt[i].second]=ways;
	}

	/*noptval=0; REP(i,nopt) optval[noptval++]=opt[i].first; sort(optval,optval+noptval); noptval=unique(optval,optval+noptval)-optval;
	REP(i,noptval) optfreq[i]=0; REP(i,nopt) { int idx=lower_bound(optval,optval+noptval,opt[i].first)-optval; opt[i].first=idx; ++optfreq[idx]; }
	printf("nopt=%d noptval=%d\n",nopt,noptval);

	REP(i,noptval) { pol[i].clear(); pol[i].PB(1); pol[i].PB(optval[i]); polpw[i]=pw(pol[i],optfreq[i]); }
	pref[0].clear(); pref[0].PB(1); REP(i,noptval) pref[i+1]=pmult(pref[i],polpw[i]);
	suff[noptval].clear(); suff[noptval].PB(1); for(int i=noptval-1;i>=0;--i) suff[i]=pmult(suff[i+1],polpw[i]);
	REP(j,noptval) {
		Pol cur=pmult(pmult(pref[j],suff[j+1]),pw(pol[j],optfreq[j]-1));
		int ways=0;
		REPSZ(k,cur) if(k<=npath) {
			ways=(ways+(ll)cur[k]*fac[npath]%MOD*ifac[npath-k])%MOD;
		}
		optans[j]=ways;
	}
	REP(j,nopt) {
		int ways=optans[opt[j].first];
		if(opt[j].second==par) waysdown[at]=(waysdown[at]+ways)%MOD; else waysup[opt[j].second]=(waysup[opt[j].second]+ways)%MOD;
	}
	REPE(i,noptval) pol[i].clear(),pref[i].clear(),suff[i].clear(); */

	//printf("at %d -> opt:",at+1); REP(j,nopt) printf(" %d=%d",opt[j].second+1,opt[j].first); puts("");
	//printf("optval:"); REP(i,noptval) printf(" %d (%d times)",optval[i],optfreq[i]); puts("");
	/*REP(i,1<<nopt) {
		int cnt=0,prod=1;
		REP(j,nopt) if(i&(1<<j)) ++cnt,prod=(ll)prod*opt[j].first%MOD;
		if(cnt>npath) continue;
		int ways=(ll)prod*fac[npath]%MOD*ifac[npath-cnt]%MOD;
		//printf("\t%x -> %d\n",i,ways);
		REP(j,nopt) if((i&(1<<j))==0) if(opt[j].second==par) waysdown[at]=(waysdown[at]+ways)%MOD; else waysup[opt[j].second]=(waysup[opt[j].second]+ways)%MOD;
	}*/
	//if(par!=-1) printf("waysdown[%d]=%d\n",at+1,waysdown[at]);
	//REP(j,nopt) if(opt[j].second!=par) printf("waysup[%d]=%d\n",opt[j].second+1,waysup[opt[j].second]);

	REPSZ(i,adj[at]) {
		int to=adj[at][i]; if(to==par) continue;
		dfsways(to,at);
		waysdown[at]=(waysdown[at]+waysdown[to])%MOD;
	}
}

int dfscalc(int at,int par) { // #ways when there is at least one edge that occurs in all paths in this subtree, and not in any other part
	int ret=0;
	// no adjacent edge in all paths
	REPSZ(i,adj[at]) {
		int to=adj[at][i]; if(to==par) continue;
		ret=(ret+dfscalc(to,at))%MOD;
	}
	// one adjacent edge in all paths
	REPSZ(i,adj[at]) {
		int to=adj[at][i]; if(to==par) continue;
		//printf("\t%d->%d: %d*%d\n",at+1,to+1,waysup[to],waysdown[to]);
		ret=(ret+(ll)waysup[to]*waysdown[to])%MOD;
	}
	// two adjacent edges in all paths
	int sum=0;
	REPSZ(i,adj[at]) {
		int to=adj[at][i]; if(to==par) continue;
		ret=(ret+(ll)sum*waysdown[to])%MOD;
		sum=(sum+waysdown[to])%MOD;
	}
	//printf("dfscalc(%d)=%d\n",at+1,ret);
	return ret;
}

int solve() {
	if(npath==1) return (ll)n*(n-1)/2%MOD;
	if(n==1) return 0;

	inv[1]=1; FORE(i,2,npath) inv[i]=(ll)(MOD-MOD/i)*inv[MOD%i]%MOD;
	fac[0]=1; FORE(i,1,npath) fac[i]=(ll)fac[i-1]*i%MOD;
	ifac[0]=1; FORE(i,1,npath) ifac[i]=(ll)ifac[i-1]*inv[i]%MOD;

	dfsinit(0,-1);
	dfsways(0,-1);
	return dfscalc(0,-1);
}

void run() {
	scanf("%d%d",&n,&npath); REP(i,n-1) { int a,b; scanf("%d%d",&a,&b); --a,--b; adj[a].PB(b),adj[b].PB(a); }
	printf("%d\n",solve());
}

void stress1() {
	n=MAXN,npath=MAXN; REP(i,n) adj[i].clear();
	int at=1; for(int len=1;at<n;++len) { int clen=min(len,n-at); int prv=0; REP(i,clen) { adj[prv].PB(at); adj[at].PB(prv); prv=at; ++at; } }
	printf("%d\n",solve());
}

void stress2() {
	n=MAXN,npath=MAXN; REP(i,n) adj[i].clear();
	int at=1; while(at<n) { int clen=1; int prv=0; REP(i,clen) { adj[prv].PB(at); adj[at].PB(prv); prv=at; ++at; } }
	printf("%d\n",solve());
}

int main() {
	run();
	//stress2();
	return 0;
}


#include<bits/stdc++.h>
#define mod 998244353
#define maxn 540000
using namespace std;
typedef long long ll;
namespace FFT{
	int bh[maxn],tmpA[maxn],tmpB[maxn],tmp[maxn],lim=maxn,w[2][maxn];
	int qpow(int a,int b){
		int ans=1,tmp=a;
		for(;b;b>>=1,tmp=1ll*tmp*tmp%mod)
			if(b&1)ans=1ll*ans*tmp%mod;
		return ans;
	}
	void init(int b){
		for(int i=1;i<(1<<b);i<<=1){
			int wn=qpow(3,(mod-1)/(i<<1));
			for(int j=0;j<i;++j)w[1][i+j]=(j?1ll*wn*w[1][i+j-1]%mod:1);
			wn=qpow(3,mod-1-(mod-1)/(i<<1));
			for(int j=0;j<i;++j)w[0][i+j]=(j?1ll*wn*w[0][i+j-1]%mod:1);
		}
	}
	void fft(int h[],int len,int flag){
		if(flag==-1)flag=0;
		for(int i=0,j=0;i<len;++i){
			if(i<j)swap(h[i],h[j]);
			for(int k=len>>1;(j^=k)<k;k>>=1);
		}
		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=h[j+k],y=1ll*h[j+k+i]*w[flag][i+k]%mod;
					h[j+k]=(1ll*x+y)%mod;
					h[j+k+i]=(1ll*x-y+mod)%mod;
				}
		if(flag==0){
			int x=qpow(len,mod-2);
			for(int i=0;i<len;++i)
				h[i]=1ll*h[i]*x%mod;
		}
	}
	void poly_mul(const int A[],int lenA,const int B[],int lenB,int C[],int lenc){
		int l=1,k=0,L=min(lenA,lenc)+min(lenB,lenc)+1;
		while(l<L)l<<=1,k++;
		memset(tmpA,0,l<<2);
		memset(tmpB,0,l<<2);
		memcpy(tmpA,A,min(lenA,lenc)<<2);
		memcpy(tmpB,B,min(lenB,lenc)<<2);
		fft(tmpA,l,1),fft(tmpB,l,1);
		for(int i=0;i<l;++i)tmpA[i]=1ll*tmpA[i]*tmpB[i]%mod;
		fft(tmpA,l,-1);
		for(int i=0;i<lenc&&i<L;++i)C[i]=tmpA[i];
		for(int i=L;i<lenc;++i)C[i]=0;
	}
	void poly_inv(int n,const int a[],int C[]){
		if(n==1){
			C[0]=qpow(a[0],mod-2);
			return ;
		}
		static int A[maxn];
		A[0]=qpow(a[0],mod-2);
		int m=(n+1)/2,len=1,k=0;
		poly_inv(m,a,C);
		while(len<n+n)len<<=1,k++;
		memcpy(A,a,n<<2);
		memset(A+n,0,(len-n)<<2);
		memset(C+m,0,(len-m)<<2);
		fft(A,len,1),fft(C,len,1);
		for(int i=0;i<len;++i)C[i]=1ll*(2ll-1ll*A[i]*C[i]%mod+mod)*C[i]%mod;
		fft(C,len,-1);
	}

	void poly_div(const int a[],int lena,const int b[],int lenb,int C[],int& plen){
		static int A[maxn],B[maxn];
		while(!a[lena-1]&&lena>=1)lena--;
		while(!b[lenb-1]&&lenb>=1)lenb--;
		if(lena<lenb){
			plen=1,C[0]=0;
			return ;
		}
		plen=lena-lenb+1;
		memcpy(A,a,lena<<2);
		memcpy(B,b,lenb<<2);
		reverse(A,A+lena);
		reverse(B,B+lenb);
		poly_inv(plen,B,tmp);
		poly_mul(tmp,plen,A,lena,C,plen);
		reverse(C,C+plen);
	}
	typedef vector<int> Poly;
	int SZ(const Poly& v){return v.size();}
	void upd(Poly& v){while(v.size()>1&&!v.back())v.pop_back();}
	Poly operator*(const Poly& a,const Poly& b){
		Poly ret(SZ(a)+SZ(b)-1);
		poly_mul(a.data(),SZ(a),b.data(),SZ(b),ret.data(),SZ(ret));
		upd(ret);
		return ret;
	}
	Poly operator/(const Poly& a,const Poly& b){
		int len;
		poly_div(a.data(),SZ(a),b.data(),SZ(b),tmp,len);
		Poly ret=Poly(tmp,tmp+len);
		upd(ret);
		return ret;
	}
	Poly operator-(const Poly& a,const Poly& b){
		Poly ret(max(SZ(a),SZ(b)));
		for(int i=0;i<SZ(ret);++i)
			ret[i]=(1ll*(i<SZ(a)?a[i]:0)-(i<SZ(b)?b[i]:0)+mod)%mod;
		upd(ret);
		return ret;
	}
	Poly operator+(const Poly& a,const Poly& b){
		Poly ret(max(SZ(a),SZ(b)));
		for(int i=0;i<SZ(ret);++i)
			ret[i]=(1ll*(i<SZ(a)?a[i]:0)+(i<SZ(b)?b[i]:0))%mod;
		upd(ret);
		return ret;
	}
	Poly operator%(const Poly& a,const Poly& b){
		int len;
		poly_div(a.data(),SZ(a),b.data(),SZ(b),tmp,len);
		poly_mul(b.data(),SZ(b),tmp,len,tmp,SZ(a));
		for(int i=0;i<SZ(a);++i)
			tmp[i]=(1ll*a[i]-tmp[i]+mod)%mod;
		for(len=SZ(a);len>1&&!tmp[len-1];len--);
		return Poly(tmp,tmp+len);
	}
	void print(const Poly& x){
		printf("\n[len=%d]",SZ(x));
		for(int i=0;i<SZ(x);++i)
			printf("%d ",x[i]);
		puts("");
	}
};
using namespace FFT;
int cas,n,wxh[maxn],akioi[maxn],lst[maxn],dp[maxn],ls[maxn],sz[maxn],ans,m;
vector<int>G[maxn];
Poly solve(int l,int r){
	if(l>r)return Poly{1};
	if(l==r)return Poly{1,wxh[l]};
	int mid=l+r>>1;
	return solve(l,mid)*solve(mid+1,r);
}
void dfs(int u,int f){
//	printf("{%d}",u);
	sz[u]=1;
	for(auto p:G[u])if(p!=f){
		dfs(p,u);
		ans=(ans+(ll)dp[u]*dp[p])%mod;
		dp[u]=(dp[u]+dp[p])%mod;
		sz[u]=(sz[u]+sz[p]);
	}
	int tp=0;
	for(auto p:G[u])if(p!=f)
		wxh[++tp]=sz[p];
	Poly ret=solve(1,tp);
	for(int i=0,z=1;i<=m&&i<ret.size();++i){
		dp[u]=(dp[u]+1ll*z*ret[i])%mod;
		z=1ll*(m-i)*z%mod;
	}
	if(u!=1){
		int p=n-sz[u];
		ret.push_back(0);
		for(int i=ret.size()-2;i>=0;--i)
			ret[i+1]=(ret[i+1]+1ll*p*ret[i])%mod;
	}
	cas++;
	for(auto p:G[u])if(p!=f){
		if(lst[p]!=cas){
			lst[p]=cas,akioi[p]=0;
			int iv=qpow(sz[p],mod-2),k=0,z=1;
			for(int i=ret.size()-1;i>=1;--i){
				int x=(ret[i]+k)%mod;
				int y=1ll*iv*x%mod;
				k=(mod-y)%mod,ls[i-1]=y;
			}
			for(int i=0,z=1;i<ret.size()-1&&i<=m;++i){
				akioi[p]=(akioi[p]+1ll*ls[i]*z)%mod;
				z=1ll*z*(m-i)%mod;
			}
		}
		ans=(ans+1ll*akioi[p]*dp[p])%mod;
	}
}
int main(){
	init(18);
	scanf("%d%d",&n,&m);
	if(m==1)return printf("%lld",(ll)n*(n-1)/2%mod),0;
	for(int i=2,u,v;i<=n;++i){
		scanf("%d%d",&u,&v);
		G[u].push_back(v);
		G[v].push_back(u);
	}
	dfs(1,0);
	printf("%d",ans);
}


#include<bits/stdc++.h>
#define mod 998244353
#define maxn 540000
using namespace std;
typedef long long ll;
namespace FFT{
	int bh[maxn],tmpA[maxn],tmpB[maxn],tmp[maxn],lim=maxn,w[2][maxn];
	int qpow(int a,int b){
		int ans=1,tmp=a;
		for(;b;b>>=1,tmp=1ll*tmp*tmp%mod)
			if(b&1)ans=1ll*ans*tmp%mod;
		return ans;
	}
	void init(int b){
		for(int i=1;i<(1<<b);i<<=1){
			int wn=qpow(3,(mod-1)/(i<<1));
			for(int j=0;j<i;++j)w[1][i+j]=(j?1ll*wn*w[1][i+j-1]%mod:1);
			wn=qpow(3,mod-1-(mod-1)/(i<<1));
			for(int j=0;j<i;++j)w[0][i+j]=(j?1ll*wn*w[0][i+j-1]%mod:1);
		}
	}
	void fft(int h[],int len,int flag){
		if(flag==-1)flag=0;
		for(int i=0,j=0;i<len;++i){
			if(i<j)swap(h[i],h[j]);
			for(int k=len>>1;(j^=k)<k;k>>=1);
		}
		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=h[j+k],y=1ll*h[j+k+i]*w[flag][i+k]%mod;
					h[j+k]=(1ll*x+y)%mod;
					h[j+k+i]=(1ll*x-y+mod)%mod;
				}
		if(flag==0){
			int x=qpow(len,mod-2);
			for(int i=0;i<len;++i)
				h[i]=1ll*h[i]*x%mod;
		}
	}
	void poly_mul(const int A[],int lenA,const int B[],int lenB,int C[],int lenc){
		int l=1,k=0,L=min(lenA,lenc)+min(lenB,lenc)+1;
		while(l<L)l<<=1,k++;
		memset(tmpA,0,l<<2);
		memset(tmpB,0,l<<2);
		memcpy(tmpA,A,min(lenA,lenc)<<2);
		memcpy(tmpB,B,min(lenB,lenc)<<2);
		fft(tmpA,l,1),fft(tmpB,l,1);
		for(int i=0;i<l;++i)tmpA[i]=1ll*tmpA[i]*tmpB[i]%mod;
		fft(tmpA,l,-1);
		for(int i=0;i<lenc&&i<L;++i)C[i]=tmpA[i];
		for(int i=L;i<lenc;++i)C[i]=0;
	}
	void poly_inv(int n,const int a[],int C[]){
		if(n==1){
			C[0]=qpow(a[0],mod-2);
			return ;
		}
		static int A[maxn];
		A[0]=qpow(a[0],mod-2);
		int m=(n+1)/2,len=1,k=0;
		poly_inv(m,a,C);
		while(len<n+n)len<<=1,k++;
		memcpy(A,a,n<<2);
		memset(A+n,0,(len-n)<<2);
		memset(C+m,0,(len-m)<<2);
		fft(A,len,1),fft(C,len,1);
		for(int i=0;i<len;++i)C[i]=1ll*(2ll-1ll*A[i]*C[i]%mod+mod)*C[i]%mod;
		fft(C,len,-1);
	}

	void poly_div(const int a[],int lena,const int b[],int lenb,int C[],int& plen){
		static int A[maxn],B[maxn];
		while(!a[lena-1]&&lena>=1)lena--;
		while(!b[lenb-1]&&lenb>=1)lenb--;
		if(lena<lenb){
			plen=1,C[0]=0;
			return ;
		}
		plen=lena-lenb+1;
		memcpy(A,a,lena<<2);
		memcpy(B,b,lenb<<2);
		reverse(A,A+lena);
		reverse(B,B+lenb);
		poly_inv(plen,B,tmp);
		poly_mul(tmp,plen,A,lena,C,plen);
		reverse(C,C+plen);
	}
	typedef vector<int> Poly;
	int SZ(const Poly& v){return v.size();}
	void upd(Poly& v){while(v.size()>1&&!v.back())v.pop_back();}
	Poly operator*(const Poly& a,const Poly& b){
		Poly ret(SZ(a)+SZ(b)-1);
		poly_mul(a.data(),SZ(a),b.data(),SZ(b),ret.data(),SZ(ret));
		upd(ret);
		return ret;
	}
	Poly operator/(const Poly& a,const Poly& b){
		int len;
		poly_div(a.data(),SZ(a),b.data(),SZ(b),tmp,len);
		Poly ret=Poly(tmp,tmp+len);
		upd(ret);
		return ret;
	}
	Poly operator-(const Poly& a,const Poly& b){
		Poly ret(max(SZ(a),SZ(b)));
		for(int i=0;i<SZ(ret);++i)
			ret[i]=(1ll*(i<SZ(a)?a[i]:0)-(i<SZ(b)?b[i]:0)+mod)%mod;
		upd(ret);
		return ret;
	}
	Poly operator+(const Poly& a,const Poly& b){
		Poly ret(max(SZ(a),SZ(b)));
		for(int i=0;i<SZ(ret);++i)
			ret[i]=(1ll*(i<SZ(a)?a[i]:0)+(i<SZ(b)?b[i]:0))%mod;
		upd(ret);
		return ret;
	}
	Poly operator%(const Poly& a,const Poly& b){
		int len;
		poly_div(a.data(),SZ(a),b.data(),SZ(b),tmp,len);
		poly_mul(b.data(),SZ(b),tmp,len,tmp,SZ(a));
		for(int i=0;i<SZ(a);++i)
			tmp[i]=(1ll*a[i]-tmp[i]+mod)%mod;
		for(len=SZ(a);len>1&&!tmp[len-1];len--);
		return Poly(tmp,tmp+len);
	}
	void print(const Poly& x){
		printf("\n[len=%d]",SZ(x));
		for(int i=0;i<SZ(x);++i)
			printf("%d ",x[i]);
		puts("");
	}
};
using namespace FFT;
int cas,n,wxh[maxn],akioi[maxn],lst[maxn],dp[maxn],ls[maxn],sz[maxn],ans,m;
vector<int>G[maxn];
Poly solve(int l,int r){
	if(l>r)return Poly{1};
	if(l==r)return Poly{1,wxh[l]};
	int mid=l+r>>1;
	return solve(l,mid)*solve(mid+1,r);
}
void dfs(int u,int f){
//	printf("{%d}",u);
	sz[u]=1;
	for(auto p:G[u])if(p!=f){
		dfs(p,u);
		ans=(ans+(ll)dp[u]*dp[p])%mod;
		dp[u]=(dp[u]+dp[p])%mod;
		sz[u]=(sz[u]+sz[p]);
	}
	int tp=0;
	for(auto p:G[u])if(p!=f)
		wxh[++tp]=sz[p];
	Poly ret=solve(1,tp);
	for(int i=0,z=1;i<=m&&i<ret.size();++i){
		dp[u]=(dp[u]+1ll*z*ret[i])%mod;
		z=1ll*(m-i)*z%mod;
	}
	if(u!=1){
		int p=n-sz[u];
		ret.push_back(0);
		for(int i=ret.size()-2;i>=0;--i)
			ret[i+1]=(ret[i+1]+1ll*p*ret[i])%mod;
	}
	cas++;
	for(auto p:G[u])if(p!=f){
		if(lst[sz[p]]!=cas){
			lst[sz[p]]=cas,akioi[sz[p]]=0;
			int iv=qpow(sz[p],mod-2),k=0,z=1;
			for(int i=ret.size()-1;i>=1;--i){
				int x=(ret[i]+k)%mod;
				int y=1ll*iv*x%mod;
				k=(mod-y)%mod,ls[i-1]=y;
			}
			for(int i=0,z=1;i<ret.size()-1&&i<=m;++i){
				akioi[sz[p]]=(akioi[sz[p]]+1ll*ls[i]*z)%mod;
				z=1ll*z*(m-i)%mod;
			}
		}
		ans=(ans+1ll*akioi[sz[p]]*dp[p])%mod;
	}
}
int main(){
	init(18);
	scanf("%d%d",&n,&m);
	if(m==1)return printf("%lld",(ll)n*(n-1)/2%mod),0;
	for(int i=2,u,v;i<=n;++i){
		scanf("%d%d",&u,&v);
		G[u].push_back(v);
		G[v].push_back(u);
	}
	dfs(1,0);
	printf("%d",ans);
}


#include<cstdio>
#include<cctype>
#include<vector>
#include<cstring>
#include<algorithm>
namespace IO
{
    char ibuf[(1<<21)+1],*iS,*iT;
    char Get(){return (iS==iT? (iT=(iS=ibuf)+fread(ibuf,1,(1<<21)+1,stdin),(iS==iT? EOF:*iS++)):*iS++);}
    int read(){int x=0,c=Get();while(!isdigit(c))c=Get();while(isdigit(c))x=x*10+c-48,c=Get();return x;}
}
using IO::read;
const int N=100007,P=998244353;
int inc(int a,int b){return a+=b-P,a+(a>>31&P);}
int dec(int a,int b){return a-=b,a+(a>>31&P);}
int mul(int a,int b){return 1ll*a*b%P;}
int pow(int a,int k=P-2){int r=1;for(;k;k>>=1,a=mul(a,a))if(k&1)r=mul(a,r);return r;}
int n,k,m,ans,lim,fac[N],ifac[N],fa[N],f[N],size[N],rev[524289],w[524289],a[524289];
std::vector<int>e[N];
void init(int n)
{
    lim=n,w[lim>>1]=1;int g=pow(3,P/lim);
    for(int i=1;i<lim;++i) rev[i]=(rev[i>>1]>>1)|(i&1? lim>>1:0);
    w[lim>>1]=1;
    for(int i=(lim>>1)+1;i<lim;++i) w[i]=mul(w[i-1],g);
    for(int i=(lim>>1)-1;i;--i) w[i]=w[i<<1];
}
void NTT(int*a,int f)
{
    if(!~f) std::reverse(a+1,a+lim);
    for(int i=0;i<lim;++i) if(i<rev[i]) std::swap(a[i],a[rev[i]]);
    for(int i=1;i<lim;i<<=1) for(int j=0,l=i<<1;j<lim;j+=l) for(int k=0,x;k<i;++k) x=mul(a[i+j+k],w[i+k]),a[i+j+k]=dec(a[j+k],x),a[j+k]=inc(a[j+k],x);
    if(!~f) for(int i=0,x=P-P/lim;i<lim;++i) a[i]=mul(a[i],x);
}
void solve(int u)
{
    int n=e[u].size()<<2;
    for(int i=0;i<n;i+=4) a[i]=1,a[i+1]=size[e[u][i>>2]];
    for(int i=4;i<n;i<<=1)
    {
	init(i);
	for(int j=0;j+i<n;j+=i<<1)
	{
	    int *p=a+j,*q=p+i;
	    NTT(p,1),NTT(q,1);
	    for(int k=0;k<i;++k) p[k]=mul(p[k],q[k]);
	    NTT(p,-1),memset(q,0,i<<2);
	}
    }
}
void Mul(int x){for(int i=m+1;i;--i) a[i]=inc(a[i],mul(x,a[i-1]));}
void Div(int x){for(int i=1;i<=m+1;++i) a[i]=dec(a[i],mul(x,a[i-1]));}
int cal(){int n=std::min(m,k),r=1;for(int i=1;i<=n;++i)r=inc(r,mul(mul(a[i],fac[k]),ifac[k-i]));return r;}
void dfs(int u)
{
    size[u]=1;
    for(int v:e[u]) e[v].erase(find(e[v].begin(),e[v].end(),u)),dfs(v),size[u]+=size[v],ans=inc(ans,mul(f[u],f[v])),f[u]=inc(f[u],f[v]);
    std::sort(e[u].begin(),e[u].end(),[](int i,int j){return size[i]<size[j];});
    solve(u),m=e[u].size(),Mul(n-size[u]);
    for(int l=0,r,s,t;l<m;l=r)
    {
	Div(t=size[e[u][l]]),s=0;
	for(r=l+1;r<m&&size[e[u][r]]==t;++r);
	for(;l<r;++l) s=inc(s,f[e[u][l]]);
	ans=inc(ans,mul(s,cal())),Mul(t);
    }
    Div(n-size[u]),f[u]=inc(f[u],cal()),memset(a,0,(m+1)<<2);
}
int main()
{
    n=read(),k=read(),m=std::max(n,k),fac[0]=1;
    if(k==1) return !printf("%d",1ll*n*(n-1)/2);
    for(int i=1;i<=m;++i) fac[i]=mul(fac[i-1],i);
    ifac[m]=pow(fac[m]);
    for(int i=m;i;--i) ifac[i-1]=mul(ifac[i],i);
    for(int i=1,u,v;i<n;++i) u=read(),v=read(),e[u].push_back(v),e[v].push_back(u);
    return dfs(1),!printf("%d",ans);
}


#include<cstdio>
#include<cctype>
#include<vector>
#include<cstring>
#include<algorithm>
namespace IO
{
    char ibuf[(1<<21)+1],*iS,*iT;
    char Get(){return (iS==iT? (iT=(iS=ibuf)+fread(ibuf,1,(1<<21)+1,stdin),(iS==iT? EOF:*iS++)):*iS++);}
    int read(){int x=0,c=Get();while(!isdigit(c))c=Get();while(isdigit(c))x=x*10+c-48,c=Get();return x;}
}
using IO::read;
const int N=100007,P=998244353;
int inc(int a,int b){return a+=b-P,a+(a>>31&P);}
int dec(int a,int b){return a-=b,a+(a>>31&P);}
int mul(int a,int b){return 1ll*a*b%P;}
int pow(int a,int k=P-2){int r=1;for(;k;k>>=1,a=mul(a,a))if(k&1)r=mul(a,r);return r;}
int n,k,m,ans,lim,fac[N],ifac[N],fa[N],f[N],size[N],rev[524289],w[524289],a[524289];
std::vector<int>e[N];
void init(int n)
{
    lim=n,w[lim>>1]=1;int g=pow(3,P/lim);
    for(int i=1;i<lim;++i) rev[i]=(rev[i>>1]>>1)|(i&1? lim>>1:0);
    w[lim>>1]=1;
    for(int i=(lim>>1)+1;i<lim;++i) w[i]=mul(w[i-1],g);
    for(int i=(lim>>1)-1;i;--i) w[i]=w[i<<1];
}
void NTT(int*a,int f)
{
    if(!~f) std::reverse(a+1,a+lim);
    for(int i=0;i<lim;++i) if(i<rev[i]) std::swap(a[i],a[rev[i]]);
    for(int i=1;i<lim;i<<=1) for(int j=0,l=i<<1;j<lim;j+=l) for(int k=0,x;k<i;++k) x=mul(a[i+j+k],w[i+k]),a[i+j+k]=dec(a[j+k],x),a[j+k]=inc(a[j+k],x);
    if(!~f) for(int i=0,x=P-P/lim;i<lim;++i) a[i]=mul(a[i],x);
}
void solve(int u)
{
    int n=e[u].size()<<2;
    for(int i=0;i<n;i+=4) a[i]=1,a[i+1]=size[e[u][i>>2]];
    for(int i=4;i<n;i<<=1)
    {
	init(i);
	for(int j=0;j+i<n;j+=i<<1)
	{
	    int *p=a+j,*q=p+i;
	    NTT(p,1),NTT(q,1);
	    for(int k=0;k<i;++k) p[k]=mul(p[k],q[k]);
	    NTT(p,-1),memset(q,0,i<<2);
	}
    }
}
void Mul(int x){for(int i=m+1;i;--i) a[i]=inc(a[i],mul(x,a[i-1]));}
void Div(int x){for(int i=1;i<=m+1;++i) a[i]=dec(a[i],mul(x,a[i-1]));}
int cal(){int n=std::min(m,k),r=1;for(int i=1;i<=n;++i)r=inc(r,mul(mul(a[i],fac[k]),ifac[k-i]));return r;}
void dfs(int u)
{
    size[u]=1;
    for(int v:e[u]) e[v].erase(find(e[v].begin(),e[v].end(),u)),dfs(v),size[u]+=size[v],ans=inc(ans,mul(f[u],f[v])),f[u]=inc(f[u],f[v]);
    std::sort(e[u].begin(),e[u].end(),[](int i,int j){return size[i]<size[j];});
    solve(u),m=e[u].size(),Mul(n-size[u]);
    for(int l=0,r,s,t;l<m;l=r)
    {
	Div(t=size[e[u][l]]),s=0;
	for(r=l+1;r<m&&size[e[u][r]]==t;++r);
	for(;l<r;++l) s=inc(s,f[e[u][l]]);
	ans=inc(ans,mul(s,cal())),Mul(t);
    }
    Div(n-size[u]),f[u]=inc(f[u],cal()),memset(a,0,(m+1)<<2);
}
int main()
{
    n=read(),k=read(),m=std::max(n,k),fac[0]=1;
    if(k==1) return !printf("%d",1ll*n*(n-1)/2%P);
    for(int i=1;i<=m;++i) fac[i]=mul(fac[i-1],i);
    ifac[m]=pow(fac[m]);
    for(int i=m;i;--i) ifac[i-1]=mul(ifac[i],i);
    for(int i=1,u,v;i<n;++i) u=read(),v=read(),e[u].push_back(v),e[v].push_back(u);
    return dfs(1),!printf("%d",ans);
}


#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
const int mo=998244353;
const int FFTN=(1<<17);
const int N=FFTN+5;
int fac[N],inv[N];
int A[N],B[N],R[N];
int w[N],W[N];
ull p[N];
int power(int x,int y){
	int s=1;
	for (;y;y/=2,x=1ll*x*x%mo)
		if (y&1) s=1ll*s*x%mo;
	return s;
}
void init(){
	fac[0]=inv[0]=inv[1]=1;
	For(i,2,N-1) inv[i]=1ll*inv[mo%i]*(mo-mo/i)%mo;
	For(i,1,N-1) inv[i]=1ll*inv[i-1]*inv[i]%mo;
	For(i,1,N-1) fac[i]=1ll*fac[i-1]*i%mo;
	W[0]=1; W[1]=power(3,(mo-1)/FFTN+1);
	For(i,2,N-1) W[i]=1ll*W[i-1]*W[1]%mo;
}
int FFTinit(int n){
	int L=1;
	for (;L<=n;L<<=1);
	For(i,0,L-1) R[i]=(R[i>>1]>>1)|((i&1)?(L>>1):0);
	return L;
}
void DFT(int *a,int n){
	For(i,0,n-1) p[R[i]]=a[i];
	for (int d=1;d<n;d<<=1){
		int len=FFTN/(d<<1);
		for (int i=0,j=0;i<d;i++,j+=len) w[i]=W[j];
		for (int i=0;i<n;i+=(d<<1))
			for (int j=0;j<d;j++){
				int y=p[i+j+d]*w[j]%mo;
				p[i+j+d]=p[i+j]+mo-y;
				p[i+j]+=y;
			}
	}
	For(i,0,n-1) a[i]=p[i]%mo;
}
void IDFT(int *a,int n){
	For(i,0,n-1) p[R[i]]=a[i];
	for (int d=1;d<n;d<<=1){
		int len=FFTN/(d<<1);
		for (int i=0,j=FFTN;i<d;i++,j-=len) w[i]=W[j];
		for (int i=0;i<n;i+=(d<<1))
			for (int j=0;j<d;j++){
				int y=p[i+j+d]*w[j]%mo;
				p[i+j+d]=p[i+j]+mo-y;
				p[i+j]+=y;
			}
	}
	int val=1ll*inv[n]*fac[n-1]%mo;
	For(i,0,n-1) a[i]=p[i]*val%mo;
}
vector<int> mult(vector<int> a,vector<int> b){
	vector<int> ans;
	int sza=a.size()-1,szb=b.size()-1;
	ans.resize(sza+szb+1);
	if (sza+szb<=100){
		For(i,0,sza) For(j,0,szb)
			ans[i+j]=(ans[i+j]+1ll*a[i]*b[j])%mo;
	}
	else{
		int L=FFTinit(sza+szb);
		For(i,0,L-1) A[i]=(i<=sza?a[i]:0);
		For(i,0,L-1) B[i]=(i<=szb?b[i]:0);
		DFT(A,L); DFT(B,L);
		For(i,0,L-1) A[i]=1ll*A[i]*B[i]%mo;
		IDFT(A,L);
		For(i,0,sza+szb) ans[i]=A[i];
	}
	return ans;
}
vector<int> divide(int l,int r,vector<int> &tmp){
	if (l==r){
		vector<int> ans;
		ans.PB(1);
		ans.PB(tmp[l]);
		return ans;
	}
	int mid=(l+r)/2;
	return mult(divide(l,mid,tmp),divide(mid+1,r,tmp));
}
vector<int> solve(vector<int> tmp){
	int sz=tmp.size();
	if (!sz){
		vector<int> ans;
		ans.PB(1);
		return ans;
	}
	return divide(0,sz-1,tmp);
}
int sz[N],fa[N];
vector<int> f[N];
int vf[N],vg[N],sf[N];
int n,k,ans,ff[N];
vector<int> e[N];
map<int,int> mp;
void dfs(int x){
	sz[x]=1;
	for (auto i:e[x])
		if (i!=fa[x]){
			fa[i]=x;
			dfs(i);
			sz[x]+=sz[i];
			sf[x]=(sf[x]+sf[i])%mo;
		}
	vector<int> tmp;
	for (auto i:e[x])
		if (i!=fa[x])
			tmp.PB(sz[i]);
	f[x]=solve(tmp);
	For(i,0,min((int)f[x].size()-1,k-1))
		vf[x]=(vf[x]+1ll*fac[k]*inv[k-i]%mo*f[x][i])%mo;
	sf[x]=(sf[x]+vf[x])%mo;
	//cout<<x<<' '<<vf[x]<<endl;
}
void dfs2(int x){
	ans=(ans+1ll*vf[x]*vg[x])%mo;
	//cout<<vf[x]<<' '<<vg[x]<<endl;
	mp.clear();
	if (x!=1){
		f[x].PB(0);
		int m=f[x].size();
		Rep(i,m-2,0) f[x][i+1]=(f[x][i+1]+1ll*f[x][i]*(n-sz[x]))%mo;
	}
	mp.clear();
	for (auto i:e[x])
		if (i!=fa[x]){
			if (!mp[sz[i]]){
				int m=f[x].size();
				For(j,0,m-1) ff[j]=f[x][j];
				For(j,0,m-2) ff[j+1]=(ff[j+1]+mo-1ll*ff[j]*sz[i])%mo;
				int vson=vg[x];
				For(j,0,min(m-2,k-1))
					vson=(vson+2ll*fac[k]*inv[k-j]%mo*ff[j])%mo;
				mp[sz[i]]=vson;
			}
			vg[i]=mp[sz[i]];
			vg[i]=(vg[i]+sf[x]+2ll*mo-sf[i]-vf[x])%mo;
		}
	for (auto i:e[x])
		if (i!=fa[x])
			dfs2(i);
}
int main(){
	init();
	//freopen("1.in","r",stdin);
	scanf("%d%d",&n,&k);
	For(i,1,n-1){
		int x,y;
		scanf("%d%d",&x,&y);
		e[x].PB(y); e[y].PB(x);
	}
	dfs(1);
	dfs2(1);
	ans=1ll*(mo+1)/2*ans%mo;
	printf("%d\n",ans);

}
/*
自己这个子树直接跑一次分治FFT即可
父子关系的系数map
*/


#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
const int mo=998244353;
const int FFTN=(1<<17);
const int N=FFTN+5;
int fac[N],inv[N];
int A[N],B[N],R[N];
int w[N],W[N];
ull p[N];
int power(int x,int y){
	int s=1;
	for (;y;y/=2,x=1ll*x*x%mo)
		if (y&1) s=1ll*s*x%mo;
	return s;
}
void init(){
	fac[0]=inv[0]=inv[1]=1;
	For(i,2,N-1) inv[i]=1ll*inv[mo%i]*(mo-mo/i)%mo;
	For(i,1,N-1) inv[i]=1ll*inv[i-1]*inv[i]%mo;
	For(i,1,N-1) fac[i]=1ll*fac[i-1]*i%mo;
	W[0]=1; W[1]=power(3,(mo-1)/FFTN);
	For(i,2,N-1) W[i]=1ll*W[i-1]*W[1]%mo;
}
int FFTinit(int n){
	int L=1;
	for (;L<=n;L<<=1);
	For(i,0,L-1) R[i]=(R[i>>1]>>1)|((i&1)?(L>>1):0);
	return L;
}
void DFT(int *a,int n){
	For(i,0,n-1) p[R[i]]=a[i];
	for (int d=1;d<n;d<<=1){
		int len=FFTN/(d<<1);
		for (int i=0,j=0;i<d;i++,j+=len) w[i]=W[j];
		for (int i=0;i<n;i+=(d<<1))
			for (int j=0;j<d;j++){
				int y=p[i+j+d]*w[j]%mo;
				p[i+j+d]=p[i+j]+mo-y;
				p[i+j]+=y;
			}
	}
	For(i,0,n-1) a[i]=p[i]%mo;
}
void IDFT(int *a,int n){
	For(i,0,n-1) p[R[i]]=a[i];
	for (int d=1;d<n;d<<=1){
		int len=FFTN/(d<<1);
		for (int i=0,j=FFTN;i<d;i++,j-=len) w[i]=W[j];
		for (int i=0;i<n;i+=(d<<1))
			for (int j=0;j<d;j++){
				int y=p[i+j+d]*w[j]%mo;
				p[i+j+d]=p[i+j]+mo-y;
				p[i+j]+=y;
			}
	}
	int val=1ll*inv[n]*fac[n-1]%mo;
	For(i,0,n-1) a[i]=p[i]*val%mo;
}
vector<int> mult(vector<int> a,vector<int> b){
	vector<int> ans;
	int sza=a.size()-1,szb=b.size()-1;
	ans.resize(sza+szb+1);
	if (sza+szb<=1){
		For(i,0,sza) For(j,0,szb)
			ans[i+j]=(ans[i+j]+1ll*a[i]*b[j])%mo;
	}
	else{
		int L=FFTinit(sza+szb);
		For(i,0,L-1) A[i]=(i<=sza?a[i]:0);
		For(i,0,L-1) B[i]=(i<=szb?b[i]:0);
		DFT(A,L); DFT(B,L);
		For(i,0,L-1) A[i]=1ll*A[i]*B[i]%mo;
		IDFT(A,L);
		For(i,0,sza+szb) ans[i]=A[i];
	}
	return ans;
}
vector<int> divide(int l,int r,vector<int> &tmp){
	if (l==r){
		vector<int> ans;
		ans.PB(1);
		ans.PB(tmp[l]);
		return ans;
	}
	int mid=(l+r)/2;
	return mult(divide(l,mid,tmp),divide(mid+1,r,tmp));
}
vector<int> solve(vector<int> tmp){
	int sz=tmp.size();
	if (!sz){
		vector<int> ans;
		ans.PB(1);
		return ans;
	}
	return divide(0,sz-1,tmp);
}
int sz[N],fa[N];
vector<int> f[N];
int vf[N],vg[N],sf[N];
int n,k,ans,ff[N];
vector<int> e[N];
map<int,int> mp;
void dfs(int x){
	sz[x]=1;
	for (auto i:e[x])
		if (i!=fa[x]){
			fa[i]=x;
			dfs(i);
			sz[x]+=sz[i];
			sf[x]=(sf[x]+sf[i])%mo;
		}
	vector<int> tmp;
	for (auto i:e[x])
		if (i!=fa[x])
			tmp.PB(sz[i]);
	f[x]=solve(tmp);
	For(i,0,min((int)f[x].size()-1,k-1))
		vf[x]=(vf[x]+1ll*fac[k]*inv[k-i]%mo*f[x][i])%mo;
	sf[x]=(sf[x]+vf[x])%mo;
	//cout<<x<<' '<<vf[x]<<endl;
}
void dfs2(int x){
	ans=(ans+1ll*vf[x]*vg[x])%mo;
	//cout<<vf[x]<<' '<<vg[x]<<endl;
	mp.clear();
	if (x!=1){
		f[x].PB(0);
		int m=f[x].size();
		Rep(i,m-2,0) f[x][i+1]=(f[x][i+1]+1ll*f[x][i]*(n-sz[x]))%mo;
	}
	mp.clear();
	for (auto i:e[x])
		if (i!=fa[x]){
			if (!mp[sz[i]]){
				int m=f[x].size();
				For(j,0,m-1) ff[j]=f[x][j];
				For(j,0,m-2) ff[j+1]=(ff[j+1]+mo-1ll*ff[j]*sz[i])%mo;
				int vson=vg[x];
				For(j,0,min(m-2,k-1))
					vson=(vson+2ll*fac[k]*inv[k-j]%mo*ff[j])%mo;
				mp[sz[i]]=vson;
			}
			vg[i]=mp[sz[i]];
			vg[i]=(vg[i]+sf[x]+2ll*mo-sf[i]-vf[x])%mo;
		}
	for (auto i:e[x])
		if (i!=fa[x])
			dfs2(i);
}
int main(){
	init();
	//freopen("1.in","r",stdin);
	scanf("%d%d",&n,&k);
	For(i,1,n-1){
		int x,y;
		scanf("%d%d",&x,&y);
		e[x].PB(y); e[y].PB(x);
	}
	dfs(1);
	dfs2(1);
	ans=1ll*(mo+1)/2*ans%mo;
	printf("%d\n",ans);

}
/*
自己这个子树直接跑一次分治FFT即可
父子关系的系数map
*/


#include<bits/stdc++.h>
#define LL long long
#define vc vector<int>

using namespace std;
const int N=1e5+10,M=(1<<18)+10,mod=998244353;
LL rd()
{
    LL x=0,w=1;char ch=0;
    while(ch<'0'||ch>'9'){if(ch=='-') w=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+(ch^48);ch=getchar();}
    return x*w;
}
int to[N<<1],nt[N<<1],hd[N],tot=1;
void adde(int x,int y)
{
    ++tot,to[tot]=y,nt[tot]=hd[x],hd[x]=tot;
    ++tot,to[tot]=x,nt[tot]=hd[y],hd[y]=tot;
}
void ad(int &x,int y){x+=y,x-=x>=mod?mod:0;}
int fpow(int a,int b){int an=1;while(b){if(b&1) an=1ll*an*a%mod;a=1ll*a*a%mod,b>>=1;}return an;}
int ginv(int a){return fpow(a,mod-2);}
int W[20],iW[20],rdr[M],pu[M],pv[M];
void ntt(int *a,int n,bool op)
{
    int l=0,y;
    while(1<<l<n) ++l;
    for(int i=0;i<n;++i)
    {
	rdr[i]=(rdr[i>>1]>>1)|((i&1)<<(l-1));
	if(i<rdr[i]) swap(a[i],a[rdr[i]]);
    }
    for(int i=1,p=0;i<n;i<<=1,++p)
    {
	int ww=op?W[p]:iW[p];
	for(int j=0;j<n;j+=i<<1)
	    for(int k=0,w=1;k<i;++k,w=1ll*w*ww%mod)
		y=1ll*a[j+k+i]*w%mod,a[j+k+i]=(a[j+k]-y+mod)%mod,a[j+k]=(a[j+k]+y)%mod;
    }
    if(!op) for(int i=0,w=ginv(n);i<n;++i) a[i]=1ll*a[i]*w%mod;
}
int n,k,ans,fac[N],iac[N],sz[N],f[N],sf[N];
vc operator + (vc a,vc b)
{
    vc an;
    int nn=a.size(),mm=b.size(),ln=max(nn,mm);
    an.resize(ln);
    for(int i=0;i<ln;++i)
    {
	an[i]=0;
	if(i<nn) ad(an[i],a[i]);
	if(i<mm) ad(an[i],b[i]);
    }
    return an;
}
vc operator * (vc a,vc b)
{
    vc an;
    int nn=a.size(),mm=b.size(),len=1;
    while(len<=nn+mm) len<<=1;
    if(!nn||!mm) return an;
    an.resize(nn+mm-1);
    if(1ll*nn*mm<=1ll*(nn+mm)*20)
    {
	for(int i=0;i<nn;++i)
	    for(int j=0;j<mm;++j)
		ad(an[i+j],1ll*a[i]*b[j]%mod);
    }
    else
    {
	for(int i=0;i<nn;++i) pu[i]=a[i];
	for(int i=0;i<mm;++i) pv[i]=b[i];
	ntt(pu,len,1),ntt(pv,len,1);
	for(int i=0;i<len;++i) pu[i]=1ll*pu[i]*pv[i]%mod;
	ntt(pu,len,0);
	for(int i=0;i<nn+mm-1;++i) an[i]=pu[i];
	memset(pu,0,sizeof(int)*len),memset(pv,0,sizeof(int)*len);
    }
    return an;
}
vc I,pa[N],nf,pb[N],ng;
vc sov1(int l,int r)
{
    if(l>r) return I;
    if(l==r) return pa[l];
    int mid=(l+r)>>1;
    return sov1(l,mid)*sov1(mid+1,r);
}
void sov2(int l,int r)
{
    if(l>=r) return;
    int mid=(l+r)>>1;
    sov2(l,mid),sov2(mid+1,r);
    pb[l]=pb[l]*pa[mid+1]+pb[mid+1]*pa[l];
    pa[l]=pa[l]*pa[mid+1];
}
int val(vc a,int z){return a[z];}
int pt;
void dfs1(int x,int ffa)
{
    sz[x]=1;
    for(int i=hd[x];i;i=nt[i])
    {
	int y=to[i];
	if(y==ffa) continue;
	dfs1(y,x),sz[x]+=sz[y];
	ad(sf[x],sf[y]);
    }
    pt=0,pa[1].clear(),pb[1].clear();
    for(int i=hd[x];i;i=nt[i])
    {
	int y=to[i];
	if(y==ffa) continue;
	++pt,pa[pt].clear(),pb[pt].clear();
	pa[pt].push_back(1),pa[pt].push_back(sz[y]),pb[pt].push_back(sf[y]);
    }
    nf=sov1(1,pt);
    int nn=nf.size();
    for(int i=0;i<nn&&i<=k;++i) ad(f[x],1ll*nf[i]*fac[k]%mod*iac[k-i]%mod);
    ad(sf[x],f[x]);
    sov2(1,pt);
    ng.clear(),ng.push_back(1),ng.push_back(n-sz[x]);
    ng=ng*pb[1];
    nn=ng.size();
    for(int i=0;i<nn&&i<=k;++i) ad(ans,1ll*ng[i]*fac[k]%mod*iac[k-i]%mod);
}
void dfs2(int x,int ffa,int sm)
{
    ad(ans,1ll*f[x]*(sm-sf[x]+mod)%mod);
    for(int i=hd[x];i;i=nt[i])
    {
	int y=to[i];
	if(y==ffa) continue;
	dfs2(y,x,(sm-f[x]+mod)%mod);
    }
}

int main()
{
    for(int i=1,p=0;p<19;i<<=1,++p)
	W[p]=fpow(3,(mod-1)/(i<<1)),iW[p]=ginv(W[p]);
    fac[0]=1;
    for(int i=1;i<=N-5;++i) fac[i]=1ll*fac[i-1]*i%mod;
    iac[N-5]=ginv(fac[N-5]);
    for(int i=N-5;i;--i) iac[i-1]=1ll*iac[i]*i%mod;
    I.push_back(1);
    n=rd(),k=rd();
    for(int i=1;i<n;++i) adde(rd(),rd());
    if(k==1){printf("%d\n",(int)(1ll*n*(n-1)/2%mod));return 0;}
    dfs1(1,0);
    ans=2ll*ans%mod;
    dfs2(1,0,sf[1]);
    ans=1ll*ans*ginv(2)%mod;
    printf("%d\n",ans);
    return 0;
}


#include<algorithm>
#include<cstring>
#include<cstdio>
#include<vector>
#define pb push_back
#define pf printf
#define ll long long
#define mod 998244353
#define inv2 499122177ll
#define G 3
#define Maxn 135000
using namespace std;
inline int read()
{
  register int X=0;
  register char ch=0;
  while(ch<48||ch>57)ch=getchar();
  while(ch>=48&&ch<=57)X=X*10+(ch^48),ch=getchar();
  return X;
}
ll powM(ll a,int t=mod-2)
{
  ll ans=1;
  while(t){
  	if(t&1)ans=ans*a%mod;
  	a=a*a%mod;t>>=1;
  }return ans;
}
int r[Maxn<<2];
const ll invG=powM(G);
void NTT(ll *f,bool op,int n)
{
  for (int i=0;i<n;i++)
    if (r[i]<i)swap(f[r[i]],f[i]);
  for (int len=1;len<n;len<<=1){
    int w=powM(op==1 ? G:invG,(mod-1)/len/2);
  	for (int p=0;p<n;p+=len+len){
  	  ll buf=1;
  	  for (int i=p;i<p+len;i++){
  	  	int sav=f[i+len]*buf%mod;
  	  	f[i+len]=(f[i]-sav+mod)%mod;
  	  	f[i]=(f[i]+sav)%mod;
  	  	buf=buf*w%mod;
	    }
    }
  }
}
ll Ak[Maxn],ans,ans2;
vector<int> g[Maxn];
ll _s[Maxn<<1],_s2[Maxn<<1],S[Maxn];
struct Data{ll *p,*p2;int c;}a[Maxn];
int n,k,siz[Maxn];
void dfs(int u,int fa)
{
  siz[u]=1;
  for (int i=0,v;i<g[u].size();i++)
    if ((v=g[u][i])!=fa)dfs(v,u);
  int tn=0;
  for (int i=0,v;i<g[u].size();i++)
    if ((v=g[u][i])!=fa){
      siz[u]+=siz[v];
      S[u]=(S[u]+S[v])%mod;
      a[++tn].c=2;
      a[tn].p2=_s2+tn*2-2;
      a[tn].p=_s+tn*2-2;
      a[tn].p[0]=1;a[tn].p[1]=siz[v];
      a[tn].p2[0]=S[v];a[tn].p2[1]=0;
    }
  if (!tn){ans-=(S[u]=1);return ;}
  static ll s1[Maxn],s2[Maxn],s3[Maxn],s4[Maxn];
  while(tn>1){
    for (int i=2;i<=tn;i+=2){
      memcpy(s1,a[i-1].p,sizeof(ll)*a[i-1].c);
      memcpy(s2,a[i-1].p2,sizeof(ll)*a[i-1].c);
      memcpy(s3,a[i].p,sizeof(ll)*a[i].c);
      memcpy(s4,a[i].p2,sizeof(ll)*a[i].c);
      int m=a[i-1].c+a[i-1].c-1,n=1;for(;n<m;n<<=1);
      for(int i=0;i<n;i++)
        r[i]=(r[i>>1]>>1)|((i&1)?n>>1:0);
      NTT(s1,1,n);NTT(s2,1,n);NTT(s3,1,n);NTT(s4,1,n);
      for (int i=0;i<n;i++){
        s4[i]=(s1[i]*s4[i]+s2[i]*s3[i])%mod;
        s1[i]=s1[i]*s3[i]%mod;
      }NTT(s1,0,n);NTT(s4,0,n);
      ll invn=powM(n);
      a[i>>1].c=min(m,k+1);
      for (int j=0;j<a[i>>1].c;j++){
        a[i-1].p[j]=s1[j]*invn%mod;
        a[i-1].p2[j]=s4[j]*invn%mod;
      }memset(s1,0,sizeof(ll)*(n+2));
      memset(s2,0,sizeof(ll)*(n+2));
      memset(s3,0,sizeof(ll)*(n+2));
      memset(s4,0,sizeof(ll)*(n+2));
      a[i>>1].p=a[i-1].p;
      a[i>>1].p2=a[i-1].p2;
    }if (tn&1)a[(tn+1)>>1]=a[tn];
    tn=(tn+1)>>1;
  }
  ll sav=0;
  for (int i=0;i<min(k+1,a[1].c);i++)
    sav=(sav+Ak[i]*a[1].p[i])%mod;
  S[u]=(S[u]+sav)%mod;
  ans=(ans-sav*(2*S[u]-sav))%mod;
  memcpy(s1,a[1].p2,sizeof(ll)*a[1].c);
  for (int i=a[1].c-1;i>=0;i--)
    s1[i+1]=(s1[i+1]+s1[i]*(n-siz[u]))%mod;
  for (int i=0;i<min(k+1,a[1].c);i++)
    ans2=(ans2+Ak[i]*s1[i])%mod;
  memset(s1,0,sizeof(ll)*(a[1].c+2));
}
int main()
{
  n=read();k=read();
  if (k==1){
    printf("%d",(int)((1ll*n*(n-1)/2)%mod));
    return 0;
  }Ak[0]=1;
  for (int i=1;i<=k;i++)Ak[i]=Ak[i-1]*(k-i+1)%mod;
  for (int i=1,ft,to;i<n;i++){
    ft=read();to=read();
    g[ft].pb(to);g[to].pb(ft);
  }dfs(1,0);ans=(ans+S[1]*S[1])%mod*inv2%mod;
  printf("%d",(int)((ans+ans2)%mod));
  return 0;
}


#include<algorithm>
#include<cstring>
#include<cstdio>
#include<vector>
#define pb push_back
#define pf printf
#define ll long long
#define mod 998244353
#define inv2 499122177ll
#define G 3
#define Maxn 135000
using namespace std;
inline int read()
{
  register int X=0;
  register char ch=0;
  while(ch<48||ch>57)ch=getchar();
  while(ch>=48&&ch<=57)X=X*10+(ch^48),ch=getchar();
  return X;
}
ll powM(ll a,int t=mod-2)
{
  ll ans=1;
  while(t){
  	if(t&1)ans=ans*a%mod;
  	a=a*a%mod;t>>=1;
  }return ans;
}
int r[Maxn<<2];
const ll invG=powM(G);
void NTT(ll *f,bool op,int n)
{
  for (int i=0;i<n;i++)
    if (r[i]<i)swap(f[r[i]],f[i]);
  for (int len=1;len<n;len<<=1){
    int w=powM(op==1 ? G:invG,(mod-1)/len/2);
  	for (int p=0;p<n;p+=len+len){
  	  ll buf=1;
  	  for (int i=p;i<p+len;i++){
  	  	int sav=f[i+len]*buf%mod;
  	  	f[i+len]=(f[i]-sav+mod)%mod;
  	  	f[i]=(f[i]+sav)%mod;
  	  	buf=buf*w%mod;
	    }
    }
  }
}
ll Ak[Maxn],ans,ans2;
vector<int> g[Maxn];
ll _s[Maxn<<1],_s2[Maxn<<1],S[Maxn];
struct Data{ll *p,*p2;int c;}a[Maxn];
int n,k,siz[Maxn];
void dfs(int u,int fa)
{
  siz[u]=1;
  for (int i=0,v;i<g[u].size();i++)
    if ((v=g[u][i])!=fa)dfs(v,u);
  int tn=0;
  for (int i=0,v;i<g[u].size();i++)
    if ((v=g[u][i])!=fa){
      siz[u]+=siz[v];
      S[u]=(S[u]+S[v])%mod;
      a[++tn].c=2;
      a[tn].p2=_s2+tn*2-2;
      a[tn].p=_s+tn*2-2;
      a[tn].p[0]=1;a[tn].p[1]=siz[v];
      a[tn].p2[0]=S[v];a[tn].p2[1]=0;
    }
  if (!tn){ans-=(S[u]=1);return ;}
  static ll s1[Maxn<<1],s2[Maxn<<1],s3[Maxn<<1],s4[Maxn<<1];
  while(tn>1){
    for (int i=2;i<=tn;i+=2){
      memcpy(s1,a[i-1].p,sizeof(ll)*a[i-1].c);
      memcpy(s2,a[i-1].p2,sizeof(ll)*a[i-1].c);
      memcpy(s3,a[i].p,sizeof(ll)*a[i].c);
      memcpy(s4,a[i].p2,sizeof(ll)*a[i].c);
      int m=a[i-1].c+a[i-1].c-1,n=1;for(;n<m;n<<=1);
      for(int i=0;i<n;i++)
        r[i]=(r[i>>1]>>1)|((i&1)?n>>1:0);
      NTT(s1,1,n);NTT(s2,1,n);NTT(s3,1,n);NTT(s4,1,n);
      for (int i=0;i<n;i++){
        s4[i]=(s1[i]*s4[i]+s2[i]*s3[i])%mod;
        s1[i]=s1[i]*s3[i]%mod;
      }NTT(s1,0,n);NTT(s4,0,n);
      ll invn=powM(n);
      a[i>>1].c=min(m,k+1);
      for (int j=0;j<a[i>>1].c;j++){
        a[i-1].p[j]=s1[j]*invn%mod;
        a[i-1].p2[j]=s4[j]*invn%mod;
      }memset(s1,0,sizeof(ll)*(n+2));
      memset(s2,0,sizeof(ll)*(n+2));
      memset(s3,0,sizeof(ll)*(n+2));
      memset(s4,0,sizeof(ll)*(n+2));
      a[i>>1].p=a[i-1].p;
      a[i>>1].p2=a[i-1].p2;
    }if (tn&1)a[(tn+1)>>1]=a[tn];
    tn=(tn+1)>>1;
  }
  ll sav=0;
  for (int i=0;i<min(k+1,a[1].c);i++)
    sav=(sav+Ak[i]*a[1].p[i])%mod;
  S[u]=(S[u]+sav)%mod;
  ans=(ans-sav*(2*S[u]-sav))%mod;
  memcpy(s1,a[1].p2,sizeof(ll)*a[1].c);
  for (int i=a[1].c-1;i>=0;i--)
    s1[i+1]=(s1[i+1]+s1[i]*(n-siz[u]))%mod;
  for (int i=0;i<min(k+1,a[1].c);i++)
    ans2=(ans2+Ak[i]*s1[i])%mod;
  memset(s1,0,sizeof(ll)*(a[1].c+2));
}
int main()
{
  n=read();k=read();
  if (k==1){
    printf("%d",(int)((1ll*n*(n-1)/2)%mod));
    return 0;
  }Ak[0]=1;
  for (int i=1;i<=k;i++)Ak[i]=Ak[i-1]*(k-i+1)%mod;
  for (int i=1,ft,to;i<n;i++){
    ft=read();to=read();
    g[ft].pb(to);g[to].pb(ft);
  }dfs(1,0);ans=(ans+S[1]*S[1])%mod*inv2%mod;
  printf("%d",(int)((ans+ans2)%mod));
  return 0;
}


#include<algorithm>
#include<cstring>
#include<cstdio>
#include<vector>
#define pb push_back
#define pf printf
#define ll long long
#define mod 998244353
#define inv2 499122177ll
#define G 3
#define Maxn 135000
using namespace std;
inline int read()
{
  register int X=0;
  register char ch=0;
  while(ch<48||ch>57)ch=getchar();
  while(ch>=48&&ch<=57)X=X*10+(ch^48),ch=getchar();
  return X;
}
ll powM(ll a,int t=mod-2)
{
  ll ans=1;
  while(t){
  	if(t&1)ans=ans*a%mod;
  	a=a*a%mod;t>>=1;
  }return ans;
}
int r[Maxn<<2];
const ll invG=powM(G);
void NTT(ll *f,bool op,int n)
{
  for (int i=0;i<n;i++)
    if (r[i]<i)swap(f[r[i]],f[i]);
  for (int len=1;len<n;len<<=1){
    int w=powM(op==1 ? G:invG,(mod-1)/len/2);
  	for (int p=0;p<n;p+=len+len){
  	  ll buf=1;
  	  for (int i=p;i<p+len;i++){
  	  	int sav=f[i+len]*buf%mod;
  	  	f[i+len]=f[i]-sav;
  	  	if (f[i+len]<0)f[i+len]+=mod;
  	  	f[i]=f[i]+sav;
  	  	if (f[i]>=mod)f[i]-=mod;
  	  	buf=buf*w%mod;
	    }
    }
  }
}
ll _g[Maxn<<1],_f[Maxn<<1];
int sn;
void times(ll *sf,ll *sg,int l1,int l2)
{
  #define g _g
  #define f _f
  memcpy(f,sf,sizeof(ll)*(l1));
  memcpy(g,sg,sizeof(ll)*(l2));
  int m=l1+l2-1,n=1;for(;n<m;n<<=1);
  if (n!=sn){sn=n;
    for(int i=0;i<n;i++)
      r[i]=(r[i>>1]>>1)|((i&1)?n>>1:0);
  }NTT(f,1,n);NTT(g,1,n);
  for(int i=0;i<n;++i)f[i]=f[i]*g[i]%mod;
  NTT(f,0,n);ll invn=powM(n);
  for(int i=0;i<m;++i)sf[i]=f[i]*invn%mod;
  memset(f,0,sizeof(ll)*(n+2));
  memset(g,0,sizeof(ll)*(n+2));
  #undef g
  #undef f
}
ll Ak[Maxn],ans,ans2;
vector<int> g[Maxn];
ll _s[Maxn<<1],_s2[Maxn<<1],s3[Maxn],s4[Maxn],S[Maxn];
struct Data{ll *p,*p2;int c;}a[Maxn];
int n,k,siz[Maxn];
void dfs(int u,int fa)
{
  siz[u]=1;
  for (int i=0,v;i<g[u].size();i++)
    if ((v=g[u][i])!=fa)dfs(v,u);
  int tn=0;
  for (int i=0,v;i<g[u].size();i++)
    if ((v=g[u][i])!=fa){
      siz[u]+=siz[v];
      S[u]=(S[u]+S[v])%mod;
      a[++tn].c=2;
      a[tn].p2=_s2+tn*2-2;
      a[tn].p=_s+tn*2-2;
      a[tn].p2[0]=S[v];
      a[tn].p2[1]=0;
      a[tn].p[0]=1;
      a[tn].p[1]=siz[v];
    }
  if (!tn){ans-=(S[u]=1);return ;}
  while(tn>1){
    for (int i=2;i<=tn;i+=2){
      memcpy(s3,a[i-1].p,sizeof(ll)*a[i-1].c);
      memcpy(s4,a[i-1].p2,sizeof(ll)*a[i-1].c);
      times(s3,a[i].p2,a[i-1].c,a[i].c);
      times(s4,a[i].p,a[i-1].c,a[i].c);
      times(a[i-1].p,a[i].p,a[i-1].c,a[i].c);
      a[i>>1].c=min(a[i-1].c+a[i].c-1,k+1);
      for (int j=0;j<a[i>>1].c;j++)
        a[i-1].p2[j]=(s3[j]+s4[j])%mod;
      memset(s3,0,sizeof(ll)*a[i>>1].c);
      memset(s4,0,sizeof(ll)*a[i>>1].c);
      a[i>>1].p=a[i-1].p;
      a[i>>1].p2=a[i-1].p2;
    }if (tn&1)a[(tn+1)>>1]=a[tn];
    tn=(tn+1)>>1;
  }
  ll sav=0;
  for (int i=0;i<min(k+1,a[1].c);i++)
    sav=(sav+Ak[i]*a[1].p[i])%mod;
  S[u]=(S[u]+sav)%mod;
  ans=(ans-sav*(2*S[u]-sav))%mod;
  memcpy(s3,a[1].p2,sizeof(ll)*a[1].c);s3[a[1].c]=0;
  for (int i=a[1].c-1;i>=0;i--)
    s3[i+1]=(s3[i+1]+s3[i]*(n-siz[u]))%mod;
  for (int i=0;i<min(k+1,a[1].c);i++)
    ans2=(ans2+Ak[i]*s3[i])%mod;
  memset(s3,0,sizeof(ll)*(a[1].c+2));
}
int main()
{
  n=read();k=read();
  if (k==1){
    printf("%d",(int)((1ll*n*(n-1)/2)%mod));
    return 0;
  }Ak[0]=1;
  for (int i=1;i<=k;i++)Ak[i]=Ak[i-1]*(k-i+1)%mod;
  for (int i=1,ft,to;i<n;i++){
    ft=read();to=read();
    g[ft].pb(to);g[to].pb(ft);
  }dfs(1,0);ans=(ans+S[1]*S[1])%mod*inv2%mod;
  printf("%d",(int)((ans+ans2)%mod));
  return 0;
}


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

#define ll long long

template <typename T>
void pfill(T* pst, const T* ped, T val) {
	for ( ; pst != ped; *(pst++) = val);
}

template <typename T>
void pcopy(T* pst, const T* ped, T* pval) {
	for ( ; pst != ped; *(pst++) = *(pval++));
}

const int N = 262144;
const int Mod = 998244353;
const int bzmax = 19;
const int g = 3;

void exgcd(int a, int b, int& x, int& y) {
	if (!b) {
		x = 1, y = 0;
	} else {
		exgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
}

int inv(int a) {
	int x, y;
	exgcd(a, Mod, x, y);
	return (x < 0) ? (x + Mod) : (x);
}

template <const int Mod = :: Mod>
class Z {
	public:
		int v;

		Z() : v(0) {	}
		Z(int v) : v(v) {	}
		Z(ll x) : v(x % Mod) {	}

		Z operator + (Z b) {
			int x = v + b.v;
			return Z((x >= Mod) ? (x - Mod) : (x));
		}
		Z operator - (Z b) {
			int x = v - b.v;
			return Z((x < 0) ? (x + Mod) : (x));
		}
		Z operator * (Z b) {
			return Z(1ll * v * b.v);
		}
		Z operator ~ () {
			return inv(v);
		}
		Z operator -() {
			return Z(0) - *this;
		}

		Z& operator += (Z b) {
			return *this = *this + b;
		}
		Z& operator -= (Z b) {
			return *this = *this - b;
		}
		Z& operator *= (Z b) {
			return *this = *this * b;
		}

//		constexpr operator int () const {
//			return v;
//		}
};

typedef Z<> Zi;

Zi qpow(Zi a, int p) {
	if (p < Mod - 1)
		p += Mod - 1;
	Zi rt = 1, pa = a;
	for ( ; p; p >>= 1, pa = pa * pa) {
		if (p & 1) {
			rt = rt * pa;
		}
	}
	return rt;
}

class NTT {
	private:
		Zi gn[bzmax + 4], _gn[bzmax + 4];
	public:

		NTT() {
			for (int i = 0; i <= bzmax; i++) {
				gn[i] = qpow(Zi(g), (Mod - 1) >> i);
				_gn[i] = qpow(Zi(g), -((Mod - 1) >> i));
			}
		}

		void operator () (Zi* f, int len, int sgn) {
			for (int i = 1, j = len >> 1, k; i < len - 1; i++, j += k) {
				if (i < j)
					swap(f[i], f[j]);
				for (k = len >> 1; k <= j; j -= k, k >>= 1);
			}

			Zi *wn = (sgn > 0) ? (gn + 1) : (_gn + 1), w, a, b;
			for (int l = 2, hl; l <= len; l <<= 1, wn++) {
				hl = l >> 1, w = 1;
				for (int i = 0; i < len; i += l, w = 1) {
					for (int j = 0; j < hl; j++, w *= *wn) {
						a = f[i + j], b = f[i + j + hl] * w;
						f[i + j] = a + b;
						f[i + j + hl] = a - b;
					}
				}
			}

			if (sgn < 0) {
				Zi invlen = ~Zi(len);
				for (int i = 0; i < len; i++) {
					f[i] *= invlen;
				}
			}
		}

		int correct_len(int len) {
			int m = 1;
			for ( ; m <= len; m <<= 1);
			return m;
		}
} NTT;

void pol_inverse(Zi* f, Zi* g, int n) {
	static Zi A[N];
	if (n == 1) {
		g[0] = ~f[0];
	} else {
		int hn = (n + 1) >> 1, t = NTT.correct_len(n << 1 | 1);
		pol_inverse(f, g, hn);

		pcopy(A, A + n, f);
		pfill(A + n, A + t, Zi(0));
		pfill(g + hn, g + t, Zi(0));
		NTT(A, t, 1);
		NTT(g, t, 1);
		for (int i = 0; i < t; i++) {
			g[i] = g[i] * (Zi(2) - g[i] * A[i]);
		}
		NTT(g, t, -1);
		pfill(g + n, g + t, Zi(0));
	}
}

typedef vector<Zi> Poly;

Poly operator + (Poly A, Poly B) {
	int n = A.size(), m = B.size();
	int t = max(n, m);
	A.resize(t), B.resize(t);
	for (int i = 0; i < t; i++) {
		A[i] += B[i];
	}
	return A;
}

Poly operator - (Poly A, Poly B) {
	int n = A.size(), m = B.size();
	int t = max(n, m);
	A.resize(t), B.resize(t);
	for (int i = 0; i < t; i++) {
		A[i] -= B[i];
	}
	return A;
}

Poly operator * (Poly A, Poly B) {
	int n = A.size(), m = B.size();
	int k = NTT.correct_len(n + m - 1);
	if (n < 20 || m < 20) {
		Poly rt (n + m - 1);
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				rt[i + j] += A[i] * B[j];
			}
		}
		return rt;
	}
	A.resize(k), B.resize(k);
	NTT(A.data(), k, 1);
	NTT(B.data(), k, 1);
	for (int i = 0; i < k; i++) {
		A[i] *= B[i];
	}
	NTT(A.data(), k, -1);
	A.resize(n + m - 1);
	return A;
}

Poly operator ~ (Poly f) {
	int n = f.size(), t = NTT.correct_len((n << 1) | 1);
	Poly rt (t);
	f.resize(t);
	pol_inverse(f.data(), rt.data(), n);
	rt.resize(n);
	return rt;
}

Poly operator / (Poly A, Poly B) {
	int n = A.size(), m = B.size();
	if (n < m) {
		return Poly {0};
	}
	int r = n - m + 1;
	reverse(A.begin(), A.end());
	reverse(B.begin(), B.end());
	A.resize(r), B.resize(r);
	A = A * ~B;
	A.resize(r);
	reverse(A.begin(), A.end());
	return A;
}

Poly operator % (Poly A, Poly B) {
	int n = A.size(), m = B.size();
	if (n < m) {
		return A;
	}
	if (m == 1) {
		return Poly {0};
	}
	A = A - A / B * B;
	A.resize(m - 1);
	return A;
}

Zi Inv[N];
void init_inv(int n) {
	Inv[0] = 0, Inv[1] = 1;
	for (int i = 2; i <= n; i++) {
		Inv[i] = Inv[Mod % i] * Zi((Mod - (Mod / i)));
	}
}

Zi fac[N], _fac[N];
Zi comb(int n, int m) {
	return (n < m) ? (0) : (fac[n] * _fac[m] * _fac[n - m]);
}
void init_fac(int n) {
	fac[0] = 1;
	for (int i = 1; i <= n; i++) {
		fac[i] = fac[i - 1] * i;
	}
	_fac[n] = ~fac[n];
	for (int i = n; i; i--) {
		_fac[i - 1] = _fac[i] * i;
	}
}

int n, K;
int sz[N];
vector<int> G[N];

void dfs1(int p, int fa) {
	sz[p] = 1;
	for (auto& e : G[p]) {
		if (e ^ fa) {
			dfs1(e, p);
			sz[p] += sz[e];
		}
	}
}

Poly dividing(int n, Zi* a) {
	if (n == 1) {
		return Poly {1, *a};
	}
	int hn = n >> 1;
	return dividing(hn, a) * dividing(n - hn, a + hn);
}

Poly divide2(Poly F, int a1, int a0) {
	Zi b = 0, _a1 = Inv[a1];
	for (int i = (signed) F.size() - 1; i; i--) {
		b = F[i] * _a1;
		F[i] = b, F[i - 1] -= b * a0;
	}
	assert(!F[0].v);
	for (int i = 0; i < (signed) F.size() - 1; i++) {
		F[i] = F[i + 1];
	}
	F.pop_back();
	return F;
}

Zi ans = 0;
Zi dfs2(int p, int fa) {
	map<int, Poly> F;
	vector<Zi> Sz;
	if (fa) {
		Sz.push_back(n - sz[p]);
	}
	for (auto& e : G[p]) {
		if (e ^ fa) {
			Sz.push_back(sz[e]);
		}
	}
	Poly H = dividing(Sz.size(), Sz.data());
	Zi rt = 0, tmp, cur;
	for (auto& e : G[p]) {
		if (e == fa) {
			continue;
		}
		Poly& f = ((F.count(sz[e])) ? (F[sz[e]]) : (F[sz[e]] = divide2(H, sz[e], 1)));
		if ((signed) f.size() > K + 1) {
			f.resize(K + 1);
		}
		tmp = dfs2(e, p), cur = 0;
		for (int i = 0; i < (signed) f.size(); i++) {
			cur += f[i] * comb(K, i) * fac[i];
		}
//		cerr << p << " " << (rt * tmp).v << " " << (tmp * cur).v << '\n';
		ans += tmp * (rt + cur);
		rt += tmp;
	}
	if (fa) {
		int x = n - sz[p];
		Poly& f = ((F.count(x)) ? (F[x]) : (F[x] = divide2(H, x, 1)));
		if ((signed) f.size() > K + 1) {
			f.resize(K + 1);
		}
		tmp = 0;
		for (int i = 0; i < (signed) f.size(); i++) {
			tmp += f[i] * comb(K, i) * fac[i];
		}
		rt += tmp;
	}
	return rt;
}

int main() {
	scanf("%d%d", &n, &K);
	if (K == 1) {
		printf("%d\n", ((n * 1ll * (n - 1)) >> 1) % Mod);
		return 0;
	}
	init_inv(n);
	init_fac(K);
	for (int i = 1, u, v; i < n; i++) {
		scanf("%d%d", &u, &v);
		G[u].push_back(v);
		G[v].push_back(u);
	}
	dfs1(1, 0);
	dfs2(1, 0);
	printf("%d\n", ans.v);
	return 0;
}