#include <bits/stdc++.h>
#pragma GCC optimize(3)
using namespace std;
const int MAXN = 100005;
const int MOD = 1e9 + 7;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch - 48);
    ch = getchar();
  }
  return x * f;
}
struct Edge {
  int to;
  int nxt;
} e[MAXN << 1];
struct node {
  int x;
  int num;
} a[MAXN];
int n, Q;
int k, m, r;
int BIT[MAXN];
long long dp[MAXN][305];
int cnt, head[MAXN];
int tim, id[MAXN], fa[MAXN], son[MAXN], siz[MAXN], dep[MAXN], top[MAXN];
inline void add_edge(int u, int v) {
  e[++cnt].to = v;
  e[cnt].nxt = head[u];
  head[u] = cnt;
}
inline bool cmp(node x, node y) { return x.num < y.num; }
inline void dfs1(int x, int fath) {
  fa[x] = fath;
  dep[x] = dep[fath] + 1;
  siz[x] = 1;
  for (int i = head[x], y; i; i = e[i].nxt) {
    y = e[i].to;
    if (y == fath) continue;
    dfs1(y, x);
    siz[x] += siz[y];
    if (siz[y] > siz[son[x]]) son[x] = y;
  }
}
inline void dfs2(int x, int topf) {
  id[x] = ++tim;
  top[x] = topf;
  if (son[x]) dfs2(son[x], topf);
  for (int i = head[x], y; i; i = e[i].nxt) {
    y = e[i].to;
    if (y != fa[x] && y != son[x]) dfs2(y, y);
  }
}
inline int qquery(int x) {
  int res = 0;
  for (int i = x; i > 0; i -= (i & (-i))) res += BIT[i];
  return res;
}
inline void update(int k, int v) {
  for (int i = k; i <= MAXN; i += (i & (-i))) BIT[i] += v;
}
inline int query_Sum(int x, int y) { return qquery(y) - qquery(x - 1); }
inline int qSum(int x, int y) {
  int res = 0;
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    res += query_Sum(id[top[x]], id[x]);
    x = fa[top[x]];
  }
  if (dep[x] < dep[y]) swap(x, y);
  res += query_Sum(id[y], id[x]);
  return res;
}
signed main() {
  ios::sync_with_stdio(0);
  n = read();
  Q = read();
  for (int i = 1, x, y; i < n; ++i) {
    x = read();
    y = read();
    add_edge(x, y);
    add_edge(y, x);
  }
  dfs1(1, 0);
  dfs2(1, 1);
  while (Q--) {
    memset(BIT, 0, sizeof(BIT));
    k = read();
    m = read();
    r = read();
    for (int i = 1; i <= k; ++i) {
      a[i].x = read();
      update(id[a[i].x], 1);
    }
    for (int i = 1; i <= k; ++i) a[i].num = qSum(a[i].x, r) - 1;
    sort(a + 1, a + k + 1, cmp);
    dp[0][0] = 1;
    for (int i = 1; i <= k; ++i) {
      for (int j = 1; j <= m; ++j) {
        dp[i][j] = (dp[i - 1][j] * (j - a[i].num) + dp[i - 1][j - 1]) % MOD;
      }
    }
    int ans = 0;
    for (int i = 1; i <= m; ++i) {
      ans += dp[k][i];
      ans %= MOD;
    }
    cout << ans << endl;
  }
  return 0;
}
