#include <bits/stdc++.h>
using namespace std;
inline char nc() {
  static char buf[100000], *l = buf, *r = buf;
  return l == r && (r = (l = buf) + fread(buf, 1, 100000, stdin), l == r)
             ? EOF
             : *l++;
}
template <class T>
void rd(T &x) {
  x = 0;
  int f = 1, ch = nc();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = nc();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 - '0' + ch;
    ch = nc();
  }
  x *= f;
}
const int mod = 1e9 + 7;
const int maxn = 1e5 + 50;
const int maxm = 300 + 5;
const int maxlog = 20;
int k, n, m, q, r;
int dfc;
int a[maxn];
int s[maxn];
int dep[maxn];
int dfn[maxn];
int pre[maxn];
int rnk[maxn];
int siz[maxn];
int DFN[maxn];
int SIZ[maxn];
int f[maxn][maxm];
int parent[maxlog][maxn];
vector<int> adj[maxn];
inline int add(int x) { return x >= mod ? x - mod : x; }
inline void addedge(int u, int v) {
  adj[u].push_back(v);
  adj[v].push_back(u);
}
void dfs(int u) {
  siz[u] = 1;
  dfn[u] = ++dfc;
  for (int i = 1; i < maxlog; ++i) {
    parent[i][u] = parent[i - 1][parent[i - 1][u]];
  }
  for (unsigned int i = 0; i < adj[u].size(); ++i) {
    int v = adj[u][i];
    if (v != parent[0][u]) {
      rnk[v] = i;
      dep[v] = dep[u] + 1;
      parent[0][v] = u;
      dfs(v);
      siz[u] += siz[v];
    }
  }
}
int lca(int u, int v) {
  if (dep[u] > dep[v]) swap(u, v);
  for (int i = maxlog - 1; ~i; --i) {
    if (dep[v] - dep[u] >= (1 << i)) {
      v = parent[i][v];
    }
  }
  if (u == v) return u;
  for (int i = maxlog - 1; ~i; --i) {
    if (parent[i][u] != parent[i][v]) {
      u = parent[i][u];
      v = parent[i][v];
    }
  }
  return parent[0][u];
}
int jump(int u, int k) {
  for (int i = maxlog - 1; ~i; --i) {
    if (k >= (1 << i)) {
      k -= 1 << i;
      u = parent[i][u];
    }
  }
  return u;
}
void init(int root, int u) {
  int w = lca(root, u);
  if (w == root) {
    DFN[u] = dfn[u] - dfn[root] + 1;
    SIZ[u] = siz[u];
  } else if (w == u) {
    int a = jump(root, dep[root] - dep[u] - 1);
    DFN[u] = siz[a] + 1;
    SIZ[u] = n - siz[a];
  } else {
    int a = jump(root, dep[root] - dep[w] - 1);
    int b = jump(u, dep[u] - dep[w] - 1);
    DFN[u] = siz[a] + dfn[u] - dfn[w] + 1;
    if (rnk[a] <= rnk[b]) {
      DFN[u] -= siz[a];
    }
    SIZ[u] = siz[u];
  }
}
inline int cmp(const int &a, const int &b) { return DFN[a] < DFN[b]; }
int main() {
  rd(n), rd(q);
  for (int i = 1; i < n; ++i) {
    int u, v;
    rd(u), rd(v);
    addedge(u, v);
  }
  dfs(1);
  for (int i = 1; i <= q; ++i) {
    rd(k), rd(m), rd(r);
    DFN[r] = 1;
    SIZ[r] = n;
    for (int j = 1; j <= k; ++j) {
      rd(a[j]);
      if (a[j] != r) init(r, a[j]);
    }
    sort(a + 1, a + k + 1, cmp);
    s[a[1]] = 1, pre[a[1]] = r;
    for (int j = 1; j <= k; ++j) {
      if (DFN[a[j + 1]] < DFN[a[j]] + SIZ[a[j]]) {
        s[a[j + 1]] = s[a[j]] + 1;
        pre[a[j + 1]] = a[j];
      }
      int l = j + 1, r = k, re = -1;
      while (l <= r) {
        int mid = (l + r) >> 1;
        if (DFN[a[mid]] < DFN[a[j]] + SIZ[a[j]])
          l = mid + 1;
        else
          r = mid - 1, re = mid;
      }
      if (re != -1 && DFN[a[re]] < DFN[pre[a[j]]] + SIZ[pre[a[j]]]) {
        s[a[re]] = s[a[j]];
        pre[a[re]] = pre[a[j]];
      }
    }
    f[0][0] = 1;
    for (int j = 1; j <= k; ++j) {
      int u = a[j];
      for (int h = 0; h < s[u]; ++h) f[j][h] = 0;
      for (int h = s[u]; h <= m; ++h) {
        f[j][h] =
            (f[j - 1][h - 1] + (long long)f[j - 1][h] * (h - s[u] + 1)) % mod;
      }
    }
    int an = 0;
    for (int h = 0; h <= m; ++h) an = add(an + f[k][h]);
    printf("%d\n", an);
  }
  return 0;
}
