#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MAX_N = 1 << 17;
int n, q;
int cnt = 0;
vector<pair<int, int>> nodes;
vector<vector<int>> g;
vector<vector<int>> ng;
vector<int> start;
vector<int> end1;
vector<int> parent;
vector<int> depth;
vector<int> ndepth;
vector<int> tree;
vector<vector<int>> dp;
vector<vector<int>> par;
void go(int node, int parent) {
  if (parent != -1) depth[node] = depth[parent] + 1;
  start[node] = cnt++;
  par[node].push_back(parent);
  for (int i = 1; i < 20; ++i)
    if (par[node][i - 1] != -1)
      par[node].push_back(par[par[node][i - 1]][i - 1]);
    else
      par[node].push_back(-1);
  for (auto nnode : g[node]) {
    if (nnode != parent) go(nnode, node);
  }
  end1[node] = cnt;
}
int dist(int a, int b) {
  if (depth[a] > depth[b]) swap(a, b);
  int res = 0;
  for (int i = 19; i >= 0; --i)
    if (par[b][i] != -1 && depth[par[b][i]] >= depth[a]) {
      res += 1 << i;
      b = par[b][i];
    }
  for (int i = 19; i >= 0; --i) {
    if (par[a][i] == -1 || par[b][i] == -1) continue;
    if (par[a][i] == par[b][i]) continue;
    res += 1 << (i + 1);
    a = par[a][i];
    b = par[b][i];
  }
  if (a != b) {
    res += 2;
  }
  return res;
}
void update(int node, int low, int high, int nlow, int nhigh, int x) {
  if (high < nlow || low > nhigh) return;
  if (nlow <= low && nhigh >= high) {
    tree[node] = x;
    return;
  }
  if (tree[node] != -2) {
    tree[node * 2 + 1] = tree[node];
    tree[node * 2 + 2] = tree[node];
    tree[node] = -2;
  }
  update(node * 2 + 1, low, (low + high) / 2, nlow, nhigh, x);
  update(node * 2 + 2, (low + high) / 2 + 1, high, nlow, nhigh, x);
}
int get_value(int node, int low, int high, int x) {
  if (low == x && high == x) {
    return tree[node];
  }
  if (tree[node] != -2) {
    tree[node * 2 + 1] = tree[node];
    tree[node * 2 + 2] = tree[node];
    tree[node] = -2;
  }
  if (x <= (low + high) / 2)
    return get_value(node * 2 + 1, low, (low + high) / 2, x);
  return get_value(node * 2 + 2, (low + high) / 2 + 1, high, x);
}
bool ancestor(int a, int b) {
  if (depth[a] > depth[b]) return false;
  for (int i = 19; i >= 0; --i)
    if (par[b][i] != -1 && depth[par[b][i]] >= depth[a]) b = par[b][i];
  return b == a;
}
int find_son(int a, int b) {
  for (int i = 19; i >= 0; --i)
    if (par[b][i] != -1 && depth[par[b][i]] > depth[a]) b = par[b][i];
  return b;
}
void find_depth(int node, int parent) {
  if (parent != -1) ndepth[node] = ndepth[parent] + 1;
  for (auto nnode : ng[node])
    if (nnode != parent) find_depth(nnode, node);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> q;
  g = vector<vector<int>>(n, vector<int>());
  ng = vector<vector<int>>(n, vector<int>());
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  start = vector<int>(n);
  end1 = vector<int>(n);
  par = vector<vector<int>>(n, vector<int>());
  depth = vector<int>(n);
  depth[0] = 0;
  go(0, -1);
  parent = vector<int>(n);
  tree = vector<int>(2 * MAX_N, -2);
  ndepth = vector<int>(n);
  for (int i = 0; i < q; ++i) {
    int k, r, m;
    cin >> k >> m >> r;
    --r;
    nodes.clear();
    for (int j = 0; j < k; ++j) {
      int node;
      cin >> node;
      --node;
      nodes.push_back({dist(node, r), node});
    }
    sort(nodes.begin(), nodes.end());
    for (int j = 0; j < k; ++j) ng[nodes[j].second].clear();
    update(0, 0, MAX_N - 1, 0, MAX_N - 1, -1);
    for (auto p : nodes) {
      parent[p.second] = get_value(0, 0, MAX_N - 1, start[p.second]);
      if (parent[p.second] != -1) {
        ng[p.second].push_back(parent[p.second]);
        ng[parent[p.second]].push_back(p.second);
      }
      if (p.second == r) {
        update(0, 0, MAX_N - 1, 0, MAX_N - 1, r);
      } else if (ancestor(p.second, r)) {
        int nnode = find_son(p.second, r);
        update(0, 0, MAX_N - 1, 0, start[nnode] - 1, p.second);
        if (end1[nnode] != n)
          update(0, 0, MAX_N - 1, end1[nnode], n - 1, p.second);
      } else {
        update(0, 0, MAX_N - 1, start[p.second], end1[p.second] - 1, p.second);
      }
    }
    for (auto p : nodes)
      if (parent[p.second] == -1) {
        ndepth[p.second] = 0;
        find_depth(p.second, -1);
      }
    vector<pair<int, int>> nnodes;
    nnodes.clear();
    for (auto p : nodes) {
      nnodes.push_back({ndepth[p.second], p.second});
    }
    sort(nnodes.begin(), nnodes.end());
    dp = vector<vector<int>>(nnodes.size() + 1, vector<int>(m + 1, 0));
    dp[0][0] = 1;
    for (int i = 1; i <= nnodes.size(); ++i)
      for (int groups = 1; groups <= m; ++groups) {
        dp[i][groups] = dp[i - 1][groups - 1];
        dp[i][groups] += (long long)dp[i - 1][groups] *
                         max(0, groups - ndepth[nnodes[i - 1].second]) % MOD;
        if (dp[i][groups] >= MOD) dp[i][groups] -= MOD;
      }
    int res = 0;
    for (int groups = 1; groups <= m; ++groups) {
      res += dp[nnodes.size()][groups];
      if (res >= MOD) res -= MOD;
    }
    cout << res << endl;
  }
  return 0;
}
