#include <bits/stdc++.h>
using namespace std;
const int nsz = 1e5, msz = 300, mod = 1e9 + 7;
int n, q, m, sz, root = 1, rt, ans;
int cnt[nsz + 5];
int dfn1[nsz + 5], dfn2[nsz + 5], pr[nsz + 5], siz[nsz + 5], dep[nsz + 5],
    hs[nsz + 5], top[nsz + 5];
int inline add(int a, int b) {
  int res = a + b;
  if (res >= mod) res -= mod;
  return res;
}
int inline sub(int a, int b) {
  int res = a - b;
  if (res < 0) res += mod;
  return res;
}
int inline mul(int a, int b) { return (long long)a * b % mod; }
struct graph {
  int sz, hd[nsz + 5];
  struct edge {
    int nxt, to;
    edge(int nxt = 0, int to = 0) { this->nxt = nxt, this->to = to; }
  };
  edge e[2 * nsz + 5];
  void inline clear(int to) {
    for (int u = 1; u <= n; ++u) hd[u] = 0;
    sz = 0;
  }
  inline edge &operator[](int id) { return e[id]; }
  void inline link(int u, int v) {
    e[++sz] = edge(hd[u], v), hd[u] = sz;
    e[++sz] = edge(hd[v], u), hd[v] = sz;
  }
};
graph g, tr;
void dfs1(int u = root) {
  siz[u] = 1;
  for (int i = g.hd[u]; i; i = g[i].nxt) {
    int v = g[i].to;
    if (v == pr[u]) continue;
    pr[v] = u;
    dep[v] = dep[u] + 1;
    dfs1(v);
    siz[u] += siz[v];
    if (siz[v] > siz[hs[u]]) hs[u] = v;
  }
}
void dfs2(int u = root, int tp = root) {
  static int t = 0;
  dfn1[u] = ++t;
  top[u] = tp;
  if (!hs[u]) return;
  dfs2(hs[u], tp);
  for (int i = g.hd[u]; i; i = g[i].nxt) {
    int v = g[i].to;
    if (v == pr[u] || v == hs[u]) continue;
    dfs2(v, v);
  }
}
int inline lca(int u, int v) {
  for (; top[u] != top[v]; v = pr[top[v]]) {
    if (dep[top[u]] > dep[top[v]]) swap(u, v);
  }
  if (dep[u] > dep[v]) swap(u, v);
  return u;
}
bool inline by_dfn1(int u, int v) { return dfn1[u] < dfn1[v]; }
bool inline by_dfn2(int u, int v) { return dfn2[u] < dfn2[v]; }
void inline build_virtual_tree(graph &g, vector<int> &nd) {
  vector<int> mre;
  static int stk[nsz + 5];
  int ss = 0;
  sort(nd.begin(), nd.end(), by_dfn1);
  nd.erase(unique(nd.begin(), nd.end()), nd.end());
  for (int i = 0; i < nd.size(); ++i) {
    int u = nd[i];
    if (!ss) {
      stk[ss++] = u;
      continue;
    }
    int p = stk[ss - 1], pp = lca(u, p);
    for (; ss > 1 && dep[stk[ss - 2]] >= dep[pp]; --ss) {
      g.link(stk[ss - 2], stk[ss - 1]);
    }
    mre.push_back(pp);
    p = stk[ss - 1];
    if (pp != p) {
      g.hd[pp] = 0;
      stk[ss - 1] = pp;
      g.link(p, pp);
    }
    stk[ss++] = u;
  }
  for (; ss > 1; --ss) {
    g.link(stk[ss - 2], stk[ss - 1]);
  }
  for (int i = 0; i < mre.size(); ++i) {
    nd.push_back(mre[i]);
  }
  sort(nd.begin(), nd.end(), by_dfn1);
  nd.erase(unique(nd.begin(), nd.end()), nd.end());
}
void inline upd(int &a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
void dfs(graph &g, int u = rt, int p = -1) {
  static int t = 0;
  if (p == -1) t = 0;
  dfn2[u] = ++t;
  for (int i = g.hd[u]; i; i = g[i].nxt) {
    int v = g[i].to;
    if (v == p) continue;
    upd(cnt[v], cnt[u]);
    dfs(g, v, u);
  }
}
int inline solve(vector<int> &nd) {
  static int dp[2][msz + 5];
  int o = 0, x = 1, res = 0;
  memset(dp, 0, sizeof(dp));
  dp[o][0] = 1;
  sort(nd.begin(), nd.end(), by_dfn2);
  for (int i = 0; i < nd.size(); ++i) {
    int u = nd[i];
    for (int k = 0; k <= m; ++k) {
      int cur = ((k - cnt[u] + 1) % mod + mod) % mod;
      dp[x][k] = add(mul(dp[o][k], cur), dp[o][k - 1]);
    }
    swap(o, x);
    memset(dp[x], 0, sizeof(dp[x]));
  }
  for (int k = 0; k <= m; ++k) {
    upd(res, dp[o][k]);
  }
  return res;
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n - 1; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    g.link(u, v);
  }
  dfs1(), dfs2();
  for (int cs = 1; cs <= q; ++cs) {
    scanf("%d%d%d", &sz, &m, &rt);
    vector<int> nd, nds;
    for (int i = 1; i <= sz; ++i) {
      int u;
      scanf("%d", &u);
      cnt[u] = 1;
      nd.push_back(u);
    }
    nds = nd;
    nds.push_back(rt);
    build_virtual_tree(tr, nds);
    dfs(tr);
    printf("%d\n", solve(nd));
    for (int i = 0; i < nds.size(); ++i) {
      int u = nds[i];
      cnt[u] = 0;
      tr.hd[u] = 0;
    }
    tr.sz = 0;
  }
}
