#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define rep(i,st,en) for(i=st;i<=en;i++)
typedef long long ll;
typedef pair<int,int> pii;
const int N = 200010;
const int LN = 20;
ll mod = 1e9+7;
ll fmod(ll b,ll exp){
ll res =1;
while(exp){if(exp&1ll)res=(res*b)%mod;
b =(b*b)%mod;exp/=2ll;
}
return res;
}
int ver[2*N]; // gives the id of the vertex in the euler array
ll bit[2*N];
int st[N],en[N],A[N]; // st and en are the start and end time of node i
int f[N];
ll dp[N];
int par[N][LN];
int mark[N],lev[N];
vector<int> adj[N];
int tim = 0,n;
/* Normal DFS and LCA functions */
void dfs(int i,int p=-1)
{
if (p+1)
{
lev[i]=lev[p]+1;
par[i][0]=p;
for(int j=1;j<LN;j++)
if (par[i][j-1]+1)
par[i][j]=par[par[i][j-1]][j-1];
}
st[i]=(++tim);
ver[tim]= i;
for(auto ve:adj[i])
if(p-ve)
dfs(ve,i);
en[i]=(++tim);
ver[tim]= i;
}
int lca(int u,int v)
{
if (lev[u]<lev[v])
swap(u,v);
for(int j=LN-1;j>=0;j--)
if (par[u][j]+1 && lev[par[u][j]]>=lev[v])
u=par[u][j];
if (u==v)
return u;
for(int j=LN-1;j>=0;j--)
{
if (par[u][j]+1 && par[u][j]!=par[v][j])
{
u=par[u][j];
v=par[v][j];
}
}
return par[u][0];
}
/* Helper functions */
inline ll add(ll a,ll b)
{
a+=b;
if(a>=mod)a-=mod;
return a;
}
void upd(int ind,int val)
{
for(int i=ind;i<=2*n;i+=(i&-i))
bit[i]+=val;
}
ll query(int ind)
{
ll res = 0;
for(int i=ind;i>0;i-=(i&-i))
res+=bit[i];
return res; // returns the number of marked nodes from 1 to ind inclusive.
}
int main()
{
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio(false);cin.tie(NULL);
int t=1,i,j,m,q,u,v,w,typ,e,k,x;
memset(par,-1,sizeof(par));
cin>>n>>q;
rep(i,1,n-1)
{
cin>>u>>v;
adj[u].pb(v);
adj[v].pb(u);
}
dfs(1,-1);
int root;
while(q--)
{
cin>>k>>x>>root;
rep(i,1,k){
cin>>A[i];
mark[A[i]]=1; //mark nodes given in the set
upd(st[A[i]],1); // range update by updating at start and end time in bit
upd(en[A[i]]+1,-1);
}
int ans_root = query(st[root]);
rep(i,1,k){
int lp = lca(A[i],root);
//query function is inclusive, hence subtract 1 to remove current node from answer
f[i]= query(st[A[i]])+ans_root-2*query(st[lp])+(mark[lp]==1)-1;
}
//Sorting level-wise using f[i] values
sort(f+1,f+k+1);
rep(i,1,k){
upd(st[A[i]],-1); // reverse the updates to nullify effect
upd(en[A[i]]+1,1);
mark[A[i]]=0; // unmark nodes in the set
}
rep(i,0,x)dp[i]=0;
dp[0]=1;
//If number of groups less than maximum height no way possible
int fl = 0;
rep(i,1,k)if(f[i]>=x)fl=1;
if(fl)cout<<"0\n";
else{
dp[0]=1;
//For every value of f[i], update dp. Note loop for j will be reverse.
rep(i,1,k){
for(int j=min(i,x);j>=0;j--)
{
if(j<=f[i])dp[j]=0; //no way possible since less than height
else dp[j]= add(((dp[j]*1ll*(j-f[i]))%mod),dp[j-1]);
}
}
ll ans = 0;
// AT MOST x in the question
rep(i,1,x){
ans = add(ans,dp[i]);
}
cout<<ans<<"\n";
}
}
return 0;
}