#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
template <class T>
using vec = vector<T>;
template <class T>
using v2d = vector<vector<T>>;
template <class T>
using v3d = vector<vector<vector<T>>>;
template <class T>
using v4d = vector<vector<vector<vector<T>>>>;
template <class T>
using prq = priority_queue<T>;
template <class T>
using rpq = priority_queue<T, vector<T>, greater<T>>;
const int MOD = 1e9 + 7;
int n, q, lg, timer;
v2d<int> tr, dad;
vec<int> lv, st, nd, seg, on;
void update(int u, int v, int idx = 0, int l = 0, int r = timer) {
  if (u < l || u > r) {
    return;
  }
  if (u == l && u == r) {
    seg[idx] += v;
    return;
  }
  int lc = idx * 2 + 1, rc = lc + 1, m = l + (r - l) / 2;
  if (u <= m) {
    update(u, v, lc, l, m);
  } else {
    update(u, v, rc, m + 1, r);
  }
  seg[idx] = seg[lc] + seg[rc];
}
int query(int u, int v, int idx = 0, int l = 0, int r = timer) {
  if (u > r || v < l) {
    return 0;
  }
  if (u <= l && v >= r) {
    return seg[idx];
  }
  int lc = idx * 2 + 1, rc = lc + 1, m = l + (r - l) / 2;
  return query(u, v, lc, l, m) + query(u, v, rc, m + 1, r);
}
void upd(int u, int v, int val) {
  update(u, val);
  update(v + 1, -val);
}
int qry(int u) { return query(0, u); }
void dfs(int pos, int dep, int prv) {
  st[pos] = timer++;
  dad[0][pos] = prv;
  lv[pos] = dep;
  for (auto& i : tr[pos]) {
    if (i != prv) {
      dfs(i, dep + 1, pos);
    }
  }
  nd[pos] = timer++;
}
pair<int, int> lca(int u, int v) {
  if (lv[u] < lv[v]) {
    swap(u, v);
  }
  int ans = 0;
  for (int i = lg - 1; i >= 0; --i) {
    if (dad[i][u] != -1 && lv[dad[i][u]] >= lv[v]) {
      ans += 1 << i;
      u = dad[i][u];
    }
  }
  if (u == v) {
    return {u, ans};
  }
  for (int i = lg - 1; i >= 0; --i) {
    if (dad[i][u] != dad[i][v]) {
      ans += 1 << (i + 1);
      u = dad[i][u];
      v = dad[i][v];
    }
  }
  return {dad[0][u], ans + 2};
}
int main() {
  scanf("%d %d", &n, &q);
  tr.assign(n, {});
  for (int i = 1; i < n; ++i) {
    int u, v;
    scanf("%d %d", &u, &v);
    --u, --v;
    tr[u].push_back(v);
    tr[v].push_back(u);
  }
  lg = ceil(log2(n + 1));
  dad.assign(lg, vec<int>(n, -1));
  lv.assign(n, -1);
  st.assign(n, -1);
  nd.assign(n, -1);
  timer = 0;
  dfs(0, 0, -1);
  for (int i = 1; i < lg; ++i) {
    for (int j = 0; j < n; ++j) {
      if (dad[i - 1][j] != -1) {
        dad[i][j] = dad[i - 1][dad[i - 1][j]];
      }
    }
  }
  seg.assign(4 * (timer + 1), 0);
  on.assign(n, 0);
  while (q--) {
    int c, m, r;
    scanf("%d %d %d", &c, &m, &r);
    --r;
    vec<pair<int, int>> nodes(c);
    for (auto& [d, i] : nodes) {
      scanf("%d", &i);
      --i;
      d = lca(r, i).second;
    }
    sort(nodes.begin(), nodes.end());
    v2d<ll> dp(2, vec<ll>(m + 1));
    dp[0][0] = 1;
    for (int i = 1; i <= c; ++i) {
      auto& prv = dp[(i & 1) ^ 1];
      auto& cur = dp[i & 1];
      int pos = nodes[i - 1].second;
      int tmp = lca(pos, r).first;
      int cnt = qry(st[pos]) + qry(st[r]) - 2 * qry(st[tmp]) + on[tmp];
      cur[0] = 0;
      for (int j = 1; j <= m; ++j) {
        cur[j] = prv[j - 1];
        if (j > cnt) {
          cur[j] = (cur[j] + (prv[j] * (j - cnt)) % MOD) % MOD;
        }
      }
      upd(st[pos], nd[pos], 1);
      on[pos] = 1;
    }
    for (auto& [d, i] : nodes) {
      upd(st[i], nd[i], -1);
      on[i] = 0;
    }
    ll ans = 0;
    for (int i = 1; i <= m; ++i) {
      ans = (ans + dp[c & 1][i]) % MOD;
    }
    printf("%lld\n", ans);
  }
}
