#include <bits/stdc++.h>
using namespace std;
int fastMax(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ y; }
int fastMin(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ x; }
const long long int MAXN = 200010;
const long long int LG = 20;
const long long int MOD = 1e9 + 7;
long long int power(long long int x, long long int y) {
  long long int res = 1;
  while (y) {
    if (y & 1) res = (res * x) % MOD;
    x = (x * x) % MOD;
    y >>= 1;
  }
  return res;
}
long long int ver[2 * MAXN];
long long int bit[2 * MAXN];
long long int st[MAXN], en[MAXN], A[MAXN];
long long int first[MAXN];
long long int dp[MAXN];
long long int par[MAXN][LG];
long long int mark[MAXN], lev[MAXN];
vector<long long int> graph[MAXN];
long long int tim = 0, n;
void dfs(long long int u, long long int p) {
  if (p + 1) {
    lev[u] = lev[p] + 1;
    par[u][0] = p;
    for (int j = (1); j <= (LG - 1); ++j)
      if (par[u][j - 1] + 1) par[u][j] = par[par[u][j - 1]][j - 1];
  }
  st[u] = ++tim;
  ver[tim] = u;
  for (long long int v : graph[u]) {
    if (p - v) dfs(v, u);
  }
  en[u] = ++tim;
  ver[tim] = u;
}
long long int lca(long long int a, long long int b) {
  if (lev[a] < lev[b]) swap(a, b);
  for (long long int j = LG - 1; j >= 0; j--)
    if (par[a][j] + 1 && lev[par[a][j]] >= lev[b]) a = par[a][j];
  if (a == b) return a;
  for (long long int j = LG - 1; j >= 0; j--) {
    if (par[a][j] + 1 && par[a][j] != par[b][j]) {
      a = par[a][j];
      b = par[b][j];
    }
  }
  return par[a][0];
}
void update(long long int idx, long long int val) {
  for (; idx <= 2 * n; idx += (idx & (-idx))) bit[idx] += val;
}
long long int query(long long int idx) {
  long long int res = 0;
  for (; idx > 0; idx -= (idx & (-idx))) res += bit[idx];
  return res;
}
void solve() {
  long long int i, j, m, q, u, v, w, typ, e, k, x;
  memset(par, -1, sizeof(par));
  cin >> n >> q;
  for (int i = (1); i <= (n - 1); ++i) {
    cin >> u >> v;
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  dfs(1, -1);
  long long int root;
  while (q--) {
    cin >> k >> x >> root;
    for (int i = (1); i <= (k); ++i) {
      cin >> A[i];
      mark[A[i]] = 1;
      update(st[A[i]], 1);
      update(en[A[i]], -1);
    }
    long long int ans_root = query(st[root]);
    for (int i = (1); i <= (k); ++i) {
      long long int lp = lca(A[i], root);
      first[i] =
          query(st[A[i]]) + ans_root - 2 * query(st[lp]) + (mark[lp] == 1) - 1;
    }
    sort(first + 1, first + k + 1);
    for (int i = (1); i <= (k); ++i) {
      update(st[A[i]], -1);
      update(en[A[i]], 1);
      mark[A[i]] = 0;
    }
    for (int i = (0); i <= (x); ++i) dp[i] = 0;
    long long int fl = 0;
    for (int i = (1); i <= (k); ++i)
      if (first[i] >= x) fl = 1;
    if (fl)
      cout << "0\n";
    else {
      dp[0] = 1;
      for (int i = (1); i <= (k); ++i) {
        for (long long int j = min((long long int)i, x); j >= 0; j--) {
          if (j <= first[i])
            dp[j] = 0;
          else
            dp[j] = ((dp[j] * (j - first[i])) % MOD + dp[j - 1]) % MOD;
        }
      }
      long long int ans = 0;
      for (int i = (1); i <= (x); ++i) ans = (ans + dp[i]) % MOD;
      cout << ans << endl;
    }
  }
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t;
  t = 1;
  while (t--) solve();
}
