#include <bits/stdc++.h>
using namespace std;
const int IT_MAX = 1 << 18;
const int INF = -1;
long long bit[IT_MAX + 10];
long long in[IT_MAX + 10];
void update(int p, long long v) {
  long long dv = v - in[p];
  in[p] = v;
  for (; p <= IT_MAX; p += p & (-p)) bit[p] += dv;
}
long long query(int p) {
  long long rv = 0;
  for (; p; p -= p & (-p)) rv += bit[p];
  return rv;
}
int largerpos(long long v) {
  if (bit[IT_MAX] <= v) return INF;
  long long p = 0;
  long long s = 0;
  for (int i = 17; i >= 0; i--) {
    if (s + bit[p + (1 << i)] <= v) {
      s += bit[p + (1 << i)];
      p |= (1 << i);
    }
  }
  return p + 1;
}
int sparceT[17][100010], lev[100010], st[100010], en[100010], ti, rev[100010];
vector<int> mat[100010];
void dfs(int p, int pa) {
  st[p] = ++ti;
  rev[ti] = p;
  for (auto x : mat[p]) {
    if (x == pa) continue;
    lev[x] = lev[p] + 1;
    sparceT[0][x] = p;
    dfs(x, p);
  }
  en[p] = ti;
  return;
}
void make_sparceT(int n) {
  for (int i = 1; i <= 16; i++)
    for (int j = 1; j <= n; j++) {
      int x = sparceT[i - 1][j];
      if (x == -1) continue;
      sparceT[i][j] = sparceT[i - 1][x];
    }
}
int make_same(int u, int v, int jump) {
  int to = sparceT[jump][u];
  if (lev[u] == lev[v])
    return u;
  else if (to == -1 || lev[to] < lev[v])
    return make_same(u, v, jump - 1);
  else
    return make_same(to, v, jump);
}
int fin_Lca(int u, int v, int jump) {
  int t1 = sparceT[jump][u], t2 = sparceT[jump][v];
  if (u == v) return u;
  if (jump == 0 && t1 == t2)
    return t1;
  else if (t1 == t2)
    return fin_Lca(u, v, jump - 1);
  else
    return fin_Lca(t1, t2, jump);
}
int lca(int u, int v) {
  if (lev[u] < lev[v]) swap(u, v);
  u = make_same(u, v, 16);
  return fin_Lca(u, v, 16);
}
void create(int u) {
  update(u, 0);
  int v = query(u), p = rev[u];
  while (true) {
    int go = largerpos(v);
    if (st[p] <= go && go <= en[p]) {
      create(go);
      mat[p].push_back(rev[go]);
    } else
      break;
  }
}
vector<int> paName, hd, lolo;
int ara[100010], m, k, r;
int h[100010], cc, vis[100010], oke[100010], oteri;
long long dp[100010][305];
stack<int> stk;
void dfs2(int p, int pa) {
  if (oteri) {
    if (r == pa)
      h[p] = 0;
    else
      h[p] = h[pa] + 1;
  } else
    h[p] = (p == pa) ? 0 : h[pa] + 1;
  oke[cc++] = h[p];
  if (oteri && p == pa) cc = 0;
  for (auto x : mat[p]) dfs2(x, p);
}
void solve() {
  paName.clear();
  hd.clear();
  lolo.clear();
  for (int i = 0; i <= k - 1; i++) mat[ara[i]].clear();
  mat[r].clear();
  int u;
  int oldPa = -1;
  cin >> k >> m >> r;
  oteri = 1;
  update(st[r], 1);
  for (int i = 0; i <= k - 1; i++) {
    cin >> u;
    ara[i] = u;
    if (u == r)
      oteri = 0;
    else
      update(st[u], 1);
  }
  int i = 0;
  while (bit[IT_MAX]) {
    u = largerpos(0);
    update(u, 0);
    if (lca(rev[u], r) != rev[u]) {
      create(u);
      hd.push_back(rev[u]);
    } else {
      u = rev[u];
      lolo.push_back(lev[u]);
      paName.push_back(u);
      if (oldPa != -1) mat[u].push_back(oldPa);
      oldPa = u;
    }
  }
  for (auto x : hd) {
    int l = lev[x], lc = lca(x, r), p;
    if (lolo.empty())
      p = r;
    else {
      int go = lower_bound(lolo.begin(), lolo.end(), lev[lc]) - lolo.begin();
      mat[paName[go]].push_back(x);
    }
  }
  cc = 0;
  dfs2(r, r);
  cc--;
  for (int i = 0; i <= cc; i++)
    for (int j = 0; j <= m; j++) dp[i][j] = 0;
  dp[0][1] = 1;
  for (int i = 1; i <= cc; i++) {
    for (int j = 0; j <= m; j++) {
      dp[i][j] = dp[i - 1][j] * (j - oke[i]);
      if (j) dp[i][j] += dp[i - 1][j - 1];
      dp[i][j] %= 1000000007;
    }
  }
  long long prin = 0;
  for (int i = 1; i <= m; i++) {
    prin += dp[cc][i];
    prin %= 1000000007;
  }
  cout << prin << endl;
}
int main() {
  ios::sync_with_stdio(false);
  int n, u, v, q;
  cin >> n >> q;
  for (int i = 1; i <= n - 1; i++) {
    cin >> u >> v;
    mat[u].push_back(v);
    mat[v].push_back(u);
  }
  memset(sparceT, -1, sizeof(sparceT));
  dfs(1, 1);
  make_sparceT(n);
  for (int i = 0; i <= n; i++) mat[i].clear();
  for (int i = 0; i <= q - 1; i++) solve();
  return 0;
}
