#include <bits/stdc++.h>
using namespace std;
inline int rei() {
  int x;
  cin >> x;
  return x;
}
inline long long rel() {
  long long x;
  cin >> x;
  return x;
}
inline string res() {
  string x;
  cin >> x;
  return x;
}
class Monoid {
 public:
  using t = int;
  static t id() { return 0; }
  static t op(const t& l, const t& r) { return l + r; }
};
template <typename M>
class SegmentTree {
  using T = typename M::t;
  const int n;
  vector<T> data;
  int size(int n_) {
    int res = 1;
    while (res < n_) {
      res <<= 1;
    }
    return res;
  }

 public:
  SegmentTree(int n_) : n(size(n_)), data(n * 2, M::id()) {}
  SegmentTree(int n_, T v) : n(size(n_)), data(n * 2, v) {}
  SegmentTree(const vector<T>& data_)
      : n(size(data_.size())), data(n * 2, M::id()) {
    init(data_);
  }
  void init() {
    for (int i = n - 1; i >= 1; i--)
      data[i] = M::op(data[i * 2], data[i * 2 + 1]);
  }
  void init(const vector<T>& data_) {
    for (int i = 0; i < (int)data_.size(); i++) data[i + n] = data_[i];
    init();
  }
  void Update(int k, const T x) {
    k += n;
    data[k] += x;
    while (k >>= 1) {
      data[k] = M::op(data[2 * k + 0], data[2 * k + 1]);
    }
  }
  T Query(int a, int b) {
    T L = M::id(), R = M::id();
    for (a += n, b += n + 1; a < b; a >>= 1, b >>= 1) {
      if (a & 1) L = M::op(L, data[a++]);
      if (b & 1) R = M::op(data[--b], R);
    }
    return M::op(L, R);
  }
  T Query(int a) { return data[a + n]; }
};
template <class T>
struct SparseTable {
  vector<T> st[21];
  void Init(int N, vector<T>& data) {
    st[0].resize(N);
    int h = 1;
    while ((1 << h) < N) {
      st[h].resize(N - (1 << h) + 1);
      h++;
    }
    for (int i = 0; i < N; i++) {
      st[0][i] = data[i];
    }
    for (int j = 1; j <= h; j++) {
      for (int i = 0; i < N - (1 << j) + 1; i++) {
        st[j][i] = min(st[j - 1][i], st[j - 1][i + (1 << (j - 1))]);
      }
    }
  }
  inline int TopBit(int t) { return 31 - __builtin_clz(t); }
  T GetMin(int b, int e) {
    e++;
    int diff = TopBit(e - b);
    return min(st[diff][b], st[diff][e - (1 << diff)]);
  }
};
struct LowestCommonAncestor {
  int N;
  vector<int> path, depth, in_order, out_order;
  std::vector<pair<int, int>> dat;
  SparseTable<pair<int, int>> table;
  LowestCommonAncestor(const vector<vector<int>>& G, int root)
      : N(G.size()),
        path(N * 2 - 1),
        depth(N * 2 - 1),
        in_order(N),
        out_order(N),
        dat(N * 2 - 1) {
    int k = 0;
    dfs(G, root, -1, 0, k);
    for (int i = 0; i < depth.size(); ++i) {
      dat[i] = make_pair(depth[i], i);
    }
    table.Init(dat.size(), dat);
  }
  int Query(int u, int v) {
    int l = min(in_order[u], in_order[v]);
    int r = max(in_order[u], in_order[v]);
    auto res = table.GetMin(l, r);
    return path[res.second];
  }
  void dfs(const vector<vector<int>>& G, int v, int f, int d, int& k) {
    in_order[v] = k;
    path[k] = v;
    depth[k++] = d;
    for (auto& e : G[v]) {
      if (e != f) {
        dfs(G, e, v, d + 1, k);
        path[k] = v;
        depth[k++] = d;
      }
    }
    out_order[v] = k - 1;
  }
};
vector<vector<int>> G;
pair<int, int> VQ[100000];
void Calc() {
  int N = rei();
  int Q = rei();
  G.resize(N);
  for (int i = 0; i < N - 1; i++) {
    int f = rei() - 1;
    int t = rei() - 1;
    G[f].push_back(t);
    G[t].push_back(f);
  }
  LowestCommonAncestor L(G, 0);
  SegmentTree<Monoid> Seg(N * 2);
  for (int query = 0; query < Q; query++) {
    int K = rei();
    int M = rei();
    int R = rei() - 1;
    for (int i = 0; i < K; i++) {
      int v = rei() - 1;
      int lc = L.Query(v, R);
      int dep = L.depth[L.in_order[v]] + L.depth[L.in_order[R]] -
                2 * L.depth[L.in_order[lc]];
      VQ[i] = {dep, v};
    }
    sort(VQ, VQ + K);
    vector<long long> DP(M + 1);
    vector<long long> DP2(M + 1);
    DP[0] = 1;
    for (int i = 0; i < K; i++) {
      int v = VQ[i].second;
      int lc = L.Query(v, R);
      int ances = Seg.Query(L.in_order[lc], L.in_order[v]) +
                  Seg.Query(L.in_order[lc], L.in_order[R]) -
                  Seg.Query(L.in_order[lc]);
      Seg.Update(L.in_order[v], 1);
      Seg.Update(L.out_order[v] + 1, -1);
      DP2[0] = 0;
      for (int j = 1; j <= M; j++) {
        DP2[j] = (DP[j] * (j - ances) + DP[j - 1]) % 1000000007;
      }
      swap(DP, DP2);
    }
    for (int i = 0; i < K; i++) {
      int v = VQ[i].second;
      Seg.Update(L.in_order[v], -1);
      Seg.Update(L.out_order[v] + 1, 1);
    }
    long long ans = 0;
    for (int i = 1; i <= M; i++) {
      ans += DP[i];
    }
    ans %= 1000000007;
    cout << ans << endl;
  }
}
int main(int argc, char** argv) {
  ios::sync_with_stdio(false), cin.tie(0);
  cout.tie(0);
  Calc();
  return 0;
}
