#include<bits/stdc++.h>
#define LL long long
const LL mod=1e9+7;
inline void read(LL &a)
{
a=0;char c=getchar();
while(c<'0'||c>'9')c=getchar();
while(c>='0'&&c<='9')
{
a=(a<<1)+(a<<3)+c-'0';
c=getchar();
}
}
inline void write(LL a)
{
if(a<0){putchar('-');a=-a;}
if(a>9)write(a/10);
putchar(a%10+'0');
}
#define maxn 2001
LL ans=0,n,k,d=0,num[maxn],point[maxn],next[maxn],to[maxn],father[maxn],step[maxn];
inline void add(LL a,LL b)
{
next[++d]=point[a];
point[a]=d;
to[d]=b;
}
inline LL fast_pow(LL a,LL b)
{
LL base=a,ans=1;
while(b)
{
if(b&1)ans=ans*base%mod;
base=base*base%mod;
b>>=1;
}
return ans;
}
inline LL dfs1(LL p)
{
LL side=point[p];
num[p]=1;
while(side)
{
if(to[side]!=father[p])
{
father[to[side]]=p;
num[p]+=dfs1(to[side]);
}
side=next[side];
}
return num[p];
}
inline LL C(LL m,LL n)
{
return step[m]*fast_pow(step[n]*step[(m-n)]%mod,mod-2)%mod;
}
inline void dfs2(LL p)
{
for(LL i=1;i<=k&&i<=num[p];i++)
if(k-i<=n-num[p]&&k-i)
ans=(ans+C(num[p],i)*C(n-num[p],k-i)%mod)%mod;
LL side=point[p];
while(side)
{
if(to[side]!=father[p])dfs2(to[side]);
side=next[side];
}
}
int main()
{
read(n);read(k);
LL st=1;
step[0]=1;
for(LL i=1;i<=n;i++)st=step[i]=i*st%mod;
memset(num,0,sizeof(num));
memset(point,0,sizeof(point));
LL u,v;
for(LL i=1;i<=n-1;i++){read(u);read(v);add(u,v);add(v,u);}
dfs1(1);
dfs2(1);
write(ans);
return 0;
}