#include <bits/stdc++.h>
using namespace std;
const long long MAX_N = (1 << 17);
const long long LOG_N = 20;
vector<long long> g[MAX_N];
long long n, q;
long long tin[MAX_N];
long long tout[MAX_N];
long long timer;
long long h[MAX_N];
long long d[2 * MAX_N];
long long anc[LOG_N][MAX_N];
long long mod = 1000 * 1000 * 1000 + 7;
long long dp[2][309];
void dfs(long long v, long long pr) {
  if (pr != -1) h[v] = h[pr] + 1;
  if (pr != -1)
    anc[0][v] = pr;
  else
    anc[0][v] = v;
  for (long long j = 1; j < LOG_N; j++) anc[j][v] = anc[j - 1][anc[j - 1][v]];
  tin[v] = timer;
  timer++;
  for (long long to : g[v]) {
    if (to != pr) dfs(to, v);
  }
  tout[v] = timer;
}
void add(long long i, long long l, long long r, long long left, long long right,
         long long x) {
  if (l == left && r == right) {
    d[i] += x;
    return;
  }
  long long m = (l + r) / 2;
  if (right <= m)
    add(i * 2, l, m, left, right, x);
  else if (left >= m)
    add(i * 2 + 1, m, r, left, right, x);
  else {
    add(i * 2, l, m, left, m, x);
    add(i * 2 + 1, m, r, m, right, x);
  }
}
long long get(long long i, long long l, long long r, long long x,
              long long cur) {
  if (l == x && r == l + 1) return cur + d[i];
  cur += d[i];
  long long m = (l + r) / 2;
  if (x < m) return get(i * 2, l, m, x, cur);
  return get(i * 2 + 1, m, r, x, cur);
}
long long find_lca(long long a, long long b) {
  for (long long j = LOG_N - 1; j >= 0; j--) {
    long long cur = anc[j][a];
    if (!(tin[cur] <= tin[b] && tout[b] <= tout[cur])) a = cur;
  }
  if (!(tin[a] <= tin[b] && tout[b] <= tout[a])) a = anc[0][a];
  return a;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> q;
  for (long long i = 0; i < n - 1; i++) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dfs(0, -1);
  for (long long j = 0; j < q; j++) {
    long long k, m, r;
    cin >> k >> m >> r;
    r--;
    vector<pair<long long, long long> > a(k);
    for (long long e = 0; e < k; e++) {
      cin >> a[e].second;
      a[e].second--;
      long long lca = find_lca(a[e].second, r);
      a[e].first = h[a[e].second] + h[r] - 2 * h[lca];
    }
    sort(a.begin(), a.end());
    for (long long i = 1; i <= m; i++) dp[0][i] = 0;
    dp[0][0] = 1;
    for (long long u = 0; u < k; u++) {
      long long v = a[u].second;
      long long e = 1 - u % 2;
      long long cnt = get(1, 0, MAX_N, tin[v], 0);
      for (long long i = 0; i <= cnt; i++) dp[e][i] = 0;
      for (long long i = cnt + 1; i <= m; i++) {
        dp[e][i] = (dp[1 - e][i - 1] + dp[1 - e][i] * (i - cnt)) % mod;
      }
      if (v == r)
        add(1, 0, MAX_N, 0, MAX_N, 1);
      else if (tin[v] <= tin[r] && tout[r] <= tout[v]) {
        add(1, 0, MAX_N, 0, MAX_N, 1);
        for (long long to : g[v]) {
          if (tin[to] <= tin[r] && tout[r] <= tout[to] && tin[to] > tin[v]) {
            add(1, 0, MAX_N, tin[to], tout[to], -1);
          }
        }
      } else
        add(1, 0, MAX_N, tin[v], tout[v], 1);
    }
    long long ans = 0;
    for (long long i = 0; i <= m; i++) {
      ans += dp[k % 2][i];
      if (ans >= mod) ans -= mod;
    }
    cout << ans << "\n";
    for (long long u = 0; u < k; u++) {
      long long v = a[u].second;
      if (v == r)
        add(1, 0, MAX_N, 0, MAX_N, -1);
      else if (tin[v] <= tin[r] && tout[r] <= tout[v]) {
        add(1, 0, MAX_N, 0, MAX_N, -1);
        for (long long to : g[v]) {
          if (tin[to] <= tin[r] && tout[r] <= tout[to] && tin[to] > tin[v])
            add(1, 0, MAX_N, tin[to], tout[to], 1);
        }
      } else
        add(1, 0, MAX_N, tin[v], tout[v], -1);
    }
  }
}
