#include <bits/stdc++.h>
using std::sort;
using std::swap;
const int MOD = 1000000007;
const int MAXN = 100010;
const int LOGN = 20;
const int MAXM = 310;
struct TREE {
  int ce;
  struct EDGE {
    int v;
    EDGE *n;
  } edge[MAXN * 2], *head[MAXN];
} real, virt;
int n, q, k, m, a[MAXN], idc, id[MAXN], depth[MAXN], up[MAXN][LOGN],
    f[MAXN][MAXM];
int stack[MAXN], ps, used[MAXN], pu, cnt[MAXN], prev;
bool c[MAXN];
void AddEdge(TREE &tree, const int u, const int v) {
  tree.edge[++tree.ce] = (TREE::EDGE){v, tree.head[u]};
  tree.head[u] = tree.edge + tree.ce;
}
void dfs_real(const int u, const int fa) {
  id[u] = ++idc;
  depth[u] = depth[fa] + 1;
  up[u][0] = fa;
  for (int i = 1; i < LOGN; i++) up[u][i] = up[up[u][i - 1]][i - 1];
  for (const TREE::EDGE *e = real.head[u]; e; e = e->n)
    if (e->v != fa) dfs_real(e->v, u);
}
inline bool SortById(const int lhs, const int rhs) { return id[lhs] < id[rhs]; }
int LCA(int l, int r) {
  if (depth[l] > depth[r]) swap(l, r);
  for (int j = LOGN - 1; j >= 0; j--) {
    if (depth[up[r][j]] >= depth[l]) r = up[r][j];
  }
  if (depth[r] > depth[l]) r = up[r][0];
  if (l == r) return l;
  for (int j = LOGN - 1; j >= 0; j--)
    if (up[l][j] != up[r][j]) {
      l = up[l][j];
      r = up[r][j];
    }
  return up[l][0];
}
void build_virtual() {
  ps = pu = 0;
  stack[++ps] = 1;
  used[pu++] = 1;
  for (int i = 1; i <= k; i++) {
    if (a[i] == 1) continue;
    int lca = LCA(a[i], stack[ps]);
    if (lca != stack[ps]) {
      while (id[lca] < id[stack[ps - 1]]) {
        AddEdge(virt, stack[ps - 1], stack[ps]);
        AddEdge(virt, stack[ps], stack[ps - 1]);
        ps--;
      }
      AddEdge(virt, lca, stack[ps]);
      AddEdge(virt, stack[ps], lca);
      if (id[lca] == id[stack[ps - 1]]) {
        ps--;
      } else {
        stack[ps] = lca;
        used[pu++] = lca;
      }
    }
    stack[++ps] = a[i];
    used[pu++] = a[i];
  }
  for (int i = 1; i < ps; i++) {
    AddEdge(virt, stack[i], stack[i + 1]);
    AddEdge(virt, stack[i + 1], stack[i]);
  }
}
void dfs_virtual(const int u, const int fa) {
  cnt[u] = cnt[fa] + c[u];
  if (c[u]) {
    if (prev == 0) {
      for (int i = 0; i <= m; i++) f[u][i] = 0;
      f[u][1] = 1;
    } else {
      for (int i = 0; i <= m; i++)
        f[u][i] = i < cnt[u]
                      ? 0
                      : static_cast<int>((f[prev][i - 1] +
                                          static_cast<long long>(f[prev][i]) *
                                              (i - cnt[u] + 1)) %
                                         MOD);
    }
    prev = u;
  }
  for (const TREE::EDGE *e = virt.head[u]; e; e = e->n)
    if (e->v != fa) dfs_virtual(e->v, u);
}
int main() {
  scanf("%d %d", &n, &q);
  for (int i = 1, u, v; i <= n - 1; i++) {
    scanf("%d %d", &u, &v);
    AddEdge(real, u, v);
    AddEdge(real, v, u);
  }
  dfs_real(1, 1);
  while (q--) {
    int r;
    scanf("%d %d %d", &k, &m, &r);
    for (int i = 1; i <= k; i++) {
      scanf("%d", &a[i]);
      c[a[i]] = true;
    }
    if (!c[r]) a[++k] = r;
    prev = 0;
    cnt[r] = 0;
    sort(a + 1, a + k + 1, SortById);
    build_virtual();
    dfs_virtual(r, r);
    int ans = 0;
    for (int i = 1; i <= m; i++) ans = (ans + f[prev][i]) % MOD;
    printf("%d\n", ans);
    virt.ce = 0;
    for (int i = 0; i < pu; i++) virt.head[used[i]] = NULL;
    for (int i = 1; i <= k; i++) c[a[i]] = false;
  }
  return 0;
}
