#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXN = 100000;
const int MAXQ = 100000;
const int MOD = 1000000007;
const int MAXLIM = 300;
struct T {
  int n;
  vector<int> adj[MAXN];
  T() { n = 0; }
  void reset() {
    for (int i = (0); i < (n); ++i) adj[i].clear();
    n = 0;
  }
  int addnode() {
    int ret = n++;
    adj[ret].clear();
    return ret;
  }
  void addedge(int a, int b) { adj[a].push_back(b), adj[b].push_back(a); }
};
struct LCA {
  int lgn;
  vector<int> dep;
  vector<vector<int>> up;
  void dfsinit(const T &t, int at, int par) {
    dep[at] = par == -1 ? 0 : dep[par] + 1;
    up[at][0] = par == -1 ? at : par;
    for (int k = (0); k < (lgn); ++k) up[at][k + 1] = up[up[at][k]][k];
    for (int i = (0); i < (((int)(t.adj[at]).size())); ++i) {
      int to = t.adj[at][i];
      if (to == par) continue;
      dfsinit(t, to, at);
    }
  }
  void init(const T &t) {
    lgn = 0;
    while ((2 << lgn) <= t.n - 1) ++lgn;
    dep = vector<int>(t.n, -1);
    up = vector<vector<int>>(t.n, vector<int>(lgn + 1, -1));
    dfsinit(t, 0, -1);
  }
  int calc(int a, int b) {
    if (dep[a] < dep[b]) swap(a, b);
    for (int k = lgn; k >= 0; --k)
      if (dep[a] - (1 << k) >= dep[b]) a = up[a][k];
    for (int k = lgn; k >= 0; --k)
      if (up[a][k] != up[b][k]) a = up[a][k], b = up[b][k];
    return a == b ? a : up[a][0];
  }
};
struct TreeCompressor {
  vector<int> preidx, dep;
  LCA lca;
  void dfsinit(const T &t, int at, int par, int &npre) {
    preidx[at] = npre++;
    dep[at] = par == -1 ? 0 : dep[par] + 1;
    for (int i = (0); i < (((int)(t.adj[at]).size())); ++i) {
      int to = t.adj[at][i];
      if (to == par) continue;
      dfsinit(t, to, at, npre);
    }
  }
  void init(const T &t) {
    preidx = dep = vector<int>(t.n, -1);
    int npre = 0;
    dfsinit(t, 0, -1, npre);
    lca.init(t);
  }
  vector<int> build(const vector<int> &nodes, T &result) {
    vector<pair<int, int>> o;
    for (int i = (0); i < (((int)(nodes).size())); ++i)
      o.push_back(make_pair(preidx[nodes[i]], i));
    sort(o.begin(), o.end());
    vector<int> ret(((int)(nodes).size()), -1);
    result.reset();
    vector<pair<int, int>> path;
    int root = 0, rootid = result.addnode();
    path.push_back(make_pair(root, rootid));
    for (int i = (0); i < (((int)(o).size())); ++i) {
      int idx = o[i].second, at = nodes[idx];
      int x = lca.calc(at, path[((int)(path).size()) - 1].first);
      while (((int)(path).size()) >= 2 &&
             dep[x] <= dep[path[((int)(path).size()) - 2].first]) {
        result.addedge(path[((int)(path).size()) - 2].second,
                       path[((int)(path).size()) - 1].second);
        path.pop_back();
      }
      if (dep[x] < dep[path[((int)(path).size()) - 1].first]) {
        int xid = result.addnode();
        result.addedge(xid, path[((int)(path).size()) - 1].second);
        path.pop_back();
        path.push_back(make_pair(x, xid));
      }
      if (dep[at] > dep[x]) {
        int atid = result.addnode();
        path.push_back(make_pair(at, atid));
      }
      ret[idx] = path[((int)(path).size()) - 1].second;
    }
    while (((int)(path).size()) >= 2) {
      result.addedge(path[((int)(path).size()) - 2].second,
                     path[((int)(path).size()) - 1].second);
      path.pop_back();
    }
    return ret;
  }
};
T t;
int nq;
vector<int> qmarked[MAXQ];
int qlim[MAXQ], qroot[MAXQ];
int qans[MAXQ];
TreeCompressor compressor;
T tcompressed;
void dfscompressed(int at, int par, const vector<bool> &marked,
                   vector<int> &pre, vector<int> &cnt, int &npre) {
  pre[npre++] = at;
  cnt[at] = par == -1 ? 0 : cnt[par] + (marked[par] ? 1 : 0);
  for (int i = (0); i < (((int)(tcompressed.adj[at]).size())); ++i) {
    int to = tcompressed.adj[at][i];
    if (to == par) continue;
    dfscompressed(to, at, marked, pre, cnt, npre);
  }
}
void solve() {
  compressor.init(t);
  for (int i = (0); i < (nq); ++i) {
    vector<int> special;
    special.push_back(qroot[i]);
    for (int j = (0); j < (((int)(qmarked[i]).size())); ++j)
      special.push_back(qmarked[i][j]);
    vector<int> mapping = compressor.build(special, tcompressed);
    vector<bool> marked(tcompressed.n, false);
    for (int i = (1); i < (((int)(special).size())); ++i)
      marked[mapping[i]] = true;
    vector<int> pre(tcompressed.n, -1), cnt(tcompressed.n, -1);
    int npre = 0;
    dfscompressed(mapping[0], -1, marked, pre, cnt, npre);
    assert(npre == ((int)(pre).size()));
    vector<int> ways(qlim[i] + 1, 0);
    ways[0] = 1;
    for (int j = (0); j < (((int)(pre).size())); ++j) {
      int at = pre[j];
      if (!marked[at]) continue;
      for (int k = qlim[i]; k >= 0; --k)
        ways[k] = ((k == 0 ? 0 : ways[k - 1]) +
                   (long long)max(0, k - cnt[at]) * ways[k]) %
                  MOD;
    }
    qans[i] = 0;
    for (int k = (0); k < (((int)(ways).size())); ++k)
      qans[i] = (qans[i] + ways[k]) % MOD;
  }
}
void run() {
  scanf("%d%d", &t.n, &nq);
  for (int i = (0); i < (t.n - 1); ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    t.adj[a].push_back(b), t.adj[b].push_back(a);
  }
  for (int i = (0); i < (nq); ++i) {
    int qcnt;
    scanf("%d%d%d", &qcnt, &qlim[i], &qroot[i]), --qroot[i];
    qmarked[i] = vector<int>(qcnt);
    for (int j = (0); j < (qcnt); ++j)
      scanf("%d", &qmarked[i][j]), --qmarked[i][j];
  }
  solve();
  for (int i = (0); i < (nq); ++i) printf("%d\n", qans[i]);
}
int main() {
  run();
  return 0;
}
