#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXN = 100000;
const int MAXLG = 16;
const int MAXQ = 100000;
const int MOD = 1000000007;
const int MAXLIM = 300;
int n, nq;
vector<int> adj[MAXN];
vector<int> qmarked[MAXQ];
int qlim[MAXQ], qroot[MAXQ];
int qans[MAXQ];
int dep[MAXN];
int par[MAXN];
int up[MAXN][MAXLG + 1];
int pre[MAXN], npre;
void dfsinit(int at) {
  dep[at] = par[at] == -1 ? 0 : dep[par[at]] + 1;
  up[at][0] = par[at] == -1 ? at : par[at];
  for (int k = (0); k < (MAXLG); ++k) up[at][k + 1] = up[up[at][k]][k];
  pre[at] = npre++;
  for (int i = (0); i < (((int)(adj[at]).size())); ++i) {
    int to = adj[at][i];
    if (to == par[at]) continue;
    par[to] = at;
    dfsinit(to);
  }
}
int getlca(int a, int b) {
  if (dep[a] < dep[b]) swap(a, b);
  for (int k = MAXLG; k >= 0; --k)
    if (dep[a] - (1 << k) >= dep[b]) a = up[a][k];
  for (int k = MAXLG; k >= 0; --k)
    if (up[a][k] != up[b][k]) a = up[a][k], b = up[b][k];
  return a == b ? a : up[a][0];
}
struct Z {
  int x, lca;
};
bool operator<(const Z &a, const Z &b) {
  if (dep[a.lca] != dep[b.lca]) return dep[a.lca] < dep[b.lca];
  return pre[a.x] < pre[b.x];
}
Z z[MAXN];
int nz;
int nreduced;
bool ismarked[MAXN];
int orig[MAXN];
vector<int> ch[MAXN];
int ways[MAXN][MAXLIM + 1];
int ways2[MAXLIM + 1];
pair<int, int> stck[MAXN];
int nstck;
int createreducednode(int o) {
  int ret = nreduced++;
  ismarked[ret] = false, ch[ret].clear(), orig[ret] = o;
  return ret;
}
int buildreducedtree(int root, int l, int r) {
  nstck = 0;
  int rootid = createreducednode(root);
  stck[nstck++] = make_pair(root, rootid);
  for (int i = (l); i < (r); ++i) {
    int at = z[i].x;
    int lca = getlca(at, stck[nstck - 1].first);
    while (nstck >= 2 && dep[lca] <= dep[stck[nstck - 2].first])
      ch[stck[nstck - 2].second].push_back(stck[nstck - 1].second), --nstck;
    if (dep[lca] < dep[stck[nstck - 1].first]) {
      int lcaid = createreducednode(lca);
      ch[lcaid].push_back(stck[nstck - 1].second), --nstck;
      stck[nstck++] = make_pair(lca, lcaid);
    }
    assert(lca == stck[nstck - 1].first);
    if (dep[at] > dep[lca]) {
      int atid = createreducednode(at);
      stck[nstck++] = make_pair(at, atid);
    }
    assert(at == stck[nstck - 1].first);
    ismarked[stck[nstck - 1].second] = true;
  }
  while (nstck >= 2)
    ch[stck[nstck - 2].second].push_back(stck[nstck - 1].second), --nstck;
  return stck[nstck - 1].second;
}
void printreducedtree(int at, int d = 0) {
  static int tmp = 0;
  if (++tmp > 20) exit(0);
  for (int i = (0); i < (d); ++i) printf("  ");
  printf("%d%s [%d]\n", at, ismarked[at] ? "!" : "", orig[at] + 1);
  for (int i = (0); i < (((int)(ch[at]).size())); ++i) {
    int to = ch[at][i];
    printreducedtree(to, d + 1);
  }
}
void dfscalc(int at, int lim) {
  for (int j = (0); j <= (lim); ++j) ways[at][j] = ismarked[at] ? j : 1;
  for (int i = (0); i < (((int)(ch[at]).size())); ++i) {
    int to = ch[at][i];
    dfscalc(to, lim);
    for (int j = (0); j <= (lim); ++j) {
      int nj = j - (ismarked[at] ? 1 : 0);
      ways[at][j] = nj < 0 ? 0 : (long long)ways[at][j] * ways[to][nj] % MOD;
    }
  }
}
int C[MAXLIM + 1][MAXLIM + 1];
void inc(int &a, int b) {
  if ((a += b) >= MOD) a -= MOD;
}
void dec(int &a, int b) {
  if ((a -= b) < 0) a += MOD;
}
int inv[MAXLIM + 1];
int fac[MAXLIM + 1];
int ifac[MAXLIM + 1];
void solve() {
  par[0] = -1;
  npre = 0;
  dfsinit(0);
  for (int i = (0); i <= (MAXLIM); ++i) {
    C[i][0] = C[i][i] = 1;
    for (int j = (1); j < (i); ++j)
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % MOD;
  }
  inv[1] = 1;
  for (int i = (2); i <= (MAXLIM); ++i)
    inv[i] = (long long)(MOD - MOD / i) * inv[MOD % i] % MOD;
  fac[0] = 1;
  for (int i = (1); i <= (MAXLIM); ++i)
    fac[i] = (long long)fac[i - 1] * i % MOD;
  ifac[0] = 1;
  for (int i = (1); i <= (MAXLIM); ++i)
    ifac[i] = (long long)ifac[i - 1] * inv[i] % MOD;
  for (int i = (0); i < (nq); ++i) {
    nz = 0;
    for (int j = (0); j < (((int)(qmarked[i]).size())); ++j) {
      int x = qmarked[i][j], lca = getlca(x, qroot[i]);
      z[nz].x = x, z[nz].lca = lca, ++nz;
    }
    sort(z, z + nz);
    int root = -1;
    nreduced = 0;
    for (int l = 0, r = l; l < nz; l = r) {
      while (r < nz && z[r].lca == z[l].lca) ++r;
      int nroot = buildreducedtree(z[l].lca, l, r);
      if (root != -1) ch[nroot].push_back(root);
      root = nroot;
    }
    int lim = qlim[i];
    dfscalc(root, lim);
    for (int j = (0); j <= (lim); ++j) ways2[j] = ways[root][j];
    for (int j = (0); j <= (lim); ++j)
      for (int k = (0); k < (j); ++k)
        dec(ways2[j], (long long)ways2[k] * C[j][k] % MOD);
    for (int j = (0); j <= (lim); ++j)
      ways2[j] = (long long)ways2[j] * ifac[j] % MOD;
    qans[i] = 0;
    for (int j = (0); j <= (lim); ++j) inc(qans[i], ways2[j]);
  }
}
void run() {
  scanf("%d%d", &n, &nq);
  for (int i = (0); i < (n - 1); ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    adj[a].push_back(b), adj[b].push_back(a);
  }
  for (int i = (0); i < (nq); ++i) {
    int qcnt;
    scanf("%d%d%d", &qcnt, &qlim[i], &qroot[i]), --qroot[i];
    qmarked[i] = vector<int>(qcnt);
    for (int j = (0); j < (qcnt); ++j)
      scanf("%d", &qmarked[i][j]), --qmarked[i][j];
  }
  solve();
  for (int i = (0); i < (nq); ++i) printf("%d\n", qans[i]);
}
int main() {
  run();
  return 0;
}
