#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
const int LN = 20;
long long mod = 1e9 + 7;
long long fmod(long long b, long long exp) {
  long long res = 1;
  while (exp) {
    if (exp & 1ll) res = (res * b) % mod;
    b = (b * b) % mod;
    exp /= 2ll;
  }
  return res;
}
long long bit[2 * N];
int st[N], ed[N], A[N];
int f[N];
long long dp[N];
int fa[N][LN];
int mark[N], dep[N];
vector<int> adj[N];
int tim = 0, n;
void dfs(int i, int p = -1) {
  if (p + 1) {
    dep[i] = dep[p] + 1;
    fa[i][0] = p;
    for (int j = 1; j < LN; j++)
      if (fa[i][j - 1] + 1) fa[i][j] = fa[fa[i][j - 1]][j - 1];
  }
  st[i] = (++tim);
  for (auto ve : adj[i])
    if (p - ve) dfs(ve, i);
  ed[i] = tim;
}
int lca(int u, int v) {
  if (dep[u] < dep[v]) swap(u, v);
  for (int j = LN - 1; j >= 0; j--)
    if (fa[u][j] + 1 && dep[fa[u][j]] >= dep[v]) u = fa[u][j];
  if (u == v) return u;
  for (int j = LN - 1; j >= 0; j--)
    if (fa[u][j] + 1 && fa[u][j] != fa[v][j]) u = fa[u][j], v = fa[v][j];
  return fa[u][0];
}
inline long long add(long long a, long long b) {
  a += b;
  if (a >= mod) a -= mod;
  return a;
}
void upd(int ind, int val) {
  for (int i = ind; i <= 2 * n; i += (i & -i)) bit[i] += val;
}
long long query(int ind) {
  long long res = 0;
  for (int i = ind; i > 0; i -= (i & -i)) res += bit[i];
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1, i, j, m, q, u, v, w, typ, e, k, x;
  memset(fa, -1, sizeof(fa));
  cin >> n >> q;
  for (i = 1; i <= n - 1; i++) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1, -1);
  int root;
  while (q--) {
    cin >> k >> x >> root;
    for (i = 1; i <= k; i++) {
      cin >> A[i];
      mark[A[i]] = 1;
      upd(st[A[i]], 1);
      upd(ed[A[i]] + 1, -1);
    }
    int ans_root = query(st[root]);
    for (i = 1; i <= k; i++) {
      int lp = lca(A[i], root);
      f[i] =
          query(st[A[i]]) + ans_root - 2 * query(st[lp]) + (mark[lp] == 1) - 1;
    }
    sort(f + 1, f + k + 1);
    for (i = 1; i <= k; i++) {
      upd(st[A[i]], -1);
      upd(ed[A[i]] + 1, 1);
      mark[A[i]] = 0;
    }
    for (i = 0; i <= x; i++) dp[i] = 0;
    dp[0] = 1;
    int fl = 0;
    for (i = 1; i <= k; i++)
      if (f[i] >= x) fl = 1;
    if (fl)
      cout << "0\n";
    else {
      dp[0] = 1;
      for (i = 1; i <= k; i++) {
        for (int j = min(i, x); j >= 0; j--) {
          if (j <= f[i])
            dp[j] = 0;
          else
            dp[j] = add(((dp[j] * 1ll * (j - f[i])) % mod), dp[j - 1]);
        }
      }
      long long ans = 0;
      for (i = 1; i <= x; i++) {
        ans = add(ans, dp[i]);
      }
      cout << ans << "\n";
    }
  }
  return 0;
}
