#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
const int MOD = 1e9 + 7;
vector<pair<int, int> > node;
vector<int> G[MAXN];
int n, q, u, v, k, m, r, dfnt = 0;
int dep[MAXN], fa[MAXN][25], dfn[MAXN][2], f[MAXN][305], a[MAXN], mark[MAXN];
void dfs(int u, int pa = 0) {
  dep[u] = dep[pa] + 1;
  fa[u][0] = pa;
  dfn[u][0] = ++dfnt;
  for (auto v : G[u]) {
    if (v == pa) continue;
    dfs(v, u);
  }
  dfn[u][1] = ++dfnt;
}
int lca(int u, int v) {
  if (dep[u] < dep[v]) swap(u, v);
  for (int j = 20; j >= 0; j--)
    if (dep[fa[u][j]] >= dep[v]) u = fa[u][j];
  if (u == v) return u;
  for (int j = 20; j >= 0; j--)
    if (fa[u][j] != fa[v][j]) u = fa[u][j], v = fa[v][j];
  return fa[u][0];
}
int bit[MAXN * 2], tag[MAXN * 2], T = 1;
inline int lowbit(int x) { return x & -x; }
inline void add(int x, int v) {
  for (int i = x; i <= (n << 1); i += lowbit(i)) {
    if (tag[i] != T) bit[i] = 0, tag[i] = T;
    bit[i] += v;
  }
}
inline int query(int x) {
  int ret = 0;
  for (int i = x; i > 0; i ^= lowbit(i)) {
    if (tag[i] != T) bit[i] = 0, tag[i] = T;
    ret += bit[i];
  }
  return ret;
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &u, &v);
    G[u].emplace_back(v);
    G[v].emplace_back(u);
  }
  dfs(1);
  for (int j = 1; j <= 20; j++)
    for (int i = 1; i <= n; i++) fa[i][j] = fa[fa[i][j - 1]][j - 1];
  for (int t = 1; t <= q; t++, T++) {
    scanf("%d%d%d", &k, &m, &r);
    node.clear();
    for (int j = 1; j <= k; j++) {
      scanf("%d", &a[j]);
      add(dfn[a[j]][0], 1), add(dfn[a[j]][1], -1);
      mark[a[j]] = T;
    }
    for (int j = 1; j <= k; j++) {
      int p = lca(a[j], r);
      int h = query(dfn[a[j]][0]) + query(dfn[r][0]) - 2 * query(dfn[p][0]) +
              (mark[p] == T ? 1 : 0) - 1;
      node.emplace_back((pair<int, int>){h, a[j]});
    }
    sort(node.begin(), node.end());
    for (int i = 0; i <= k; i++)
      for (int j = 0; j <= m; j++) f[i][j] = 0;
    f[0][0] = 1;
    for (int i = 1; i <= k; i++)
      for (int j = 1; j <= i && j <= m; j++)
        f[i][j] = ((long long)f[i - 1][j] * (j - node[i - 1].first) % MOD +
                   f[i - 1][j - 1]) %
                  MOD;
    long long res = 0;
    for (int j = 1; j <= m; j++) {
      res += f[k][j];
      if (res >= MOD) res -= MOD;
    }
    printf("%I64d\n", res);
  }
  return 0;
}
