#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma warning(disable : 4786)
#pragma warning(disable : 4996)
using namespace std;
const long long inf = 1e18;
const int mod = 1e9 + 7;
const int M = 100005;
inline long long bigmod(long long B, long long P) {
  long long R = 1;
  while (P > 0) {
    if (P & 1) {
      R = (R * B) % mod;
    }
    P >>= 1;
    B = (B * B) % mod;
  }
  return R;
}
inline long long ad(long long x, long long y) {
  long long ret = (x % mod + y % mod) % mod;
  if (ret < 0) {
    ret += mod, ret = ret % mod;
  }
  return ret;
}
inline long long sub(long long x, long long y) {
  long long ret = ((x % mod) - (y % mod) + mod) % mod;
  if (ret < 0) {
    ret += mod, ret = ret % mod;
  }
  return ret;
}
inline long long gun(long long x, long long y) {
  long long ret = ((x % mod) * (y % mod)) % mod;
  if (ret < 0) {
    ret += mod, ret = ret % mod;
  }
  return ret;
}
namespace hld {
int r, n, id;
vector<int> adj[100010];
int nodeval[100010], lazy[4 * 100010], tree[4 * 100010];
int parent[100010], children[100010], height[100010], num[100010], up[100010],
    down[100010];
void dfs(int i, int p) {
  parent[i] = p, children[i] = 1;
  if (i != p) height[i] = height[p] + 1;
  int j, x, len = adj[i].size();
  for (j = 0; j < len; j++) {
    x = adj[i][j];
    if (x != p) {
      dfs(x, i);
      children[i] += children[x];
    }
  }
}
void build(int i, int p) {
  up[i] = i;
  if (num[i]) up[i] = up[p];
  int j, x, h = -1, l = adj[i].size();
  for (j = 0; j < l; j++) {
    x = adj[i][j];
    if ((x != p) && ((children[x] << 1) >= children[i])) h = x;
  }
  if (h != -1) {
    num[h] = ++id;
    build(h, i);
  }
  for (j = 0, down[i] = h; j < l; j++) {
    x = adj[i][j];
    if ((x != p) && (x != h)) build(x, i);
  }
}
void update_rmq(int idx, int a, int b, int l, int r, int x);
void build(int root) {
  r = root, id = 0, height[r] = 0;
  dfs(r, r);
  build(r, r);
  for (int i = 0; i < n; i++) {
    if (up[i] == i) up[i] = parent[i];
  }
  memset(lazy, 0, sizeof(lazy));
  ;
  for (int i = 0; i < (100010 << 2); i++) tree[i] = 0;
  for (int i = 0; i < n; i++) {
    if (num[i]) update_rmq(1, 1, id, num[i], num[i], nodeval[i]);
  }
}
void build() { build(0); }
int lca(int a, int b) {
  while (up[a] != up[b]) {
    if (height[up[a]] > height[up[b]])
      a = up[a];
    else
      b = up[b];
  }
  if (a == b) return a;
  if (num[a] && num[b]) {
    if (height[a] < height[b])
      return a;
    else
      return b;
  }
  return up[a];
}
void add_edge(int a, int b) {
  adj[a].push_back(b);
  adj[b].push_back(a);
}
void init(int nodes, int* ar) {
  memset(num, 0, sizeof(num));
  ;
  n = nodes;
  for (int i = 0; i < 100010; i++) adj[i].clear();
  for (int i = 0; i < n; i++) nodeval[i] = ar[i];
}
inline void push(int idx, int a, int b) {
  int c = (a + b) >> 1, d = c + 1, p = idx << 1, q = p | 1;
  if (lazy[idx]) {
    tree[idx] += (lazy[idx] * (b - a + 1));
    if (a != b) lazy[p] += lazy[idx], lazy[q] += lazy[idx];
    lazy[idx] = 0;
  }
}
int query_rmq(int idx, int a, int b, int l, int r) {
  int c = (a + b) >> 1, d = c + 1, p = idx << 1, q = p | 1;
  push(idx, a, b);
  if (a == l && b == r)
    return tree[idx];
  else if (r <= c)
    return query_rmq(p, a, c, l, r);
  else if (l >= d)
    return query_rmq(q, d, b, l, r);
  else
    return ((query_rmq(p, a, c, l, c)) + (query_rmq(q, d, b, d, r)));
}
void update_rmq(int idx, int a, int b, int l, int r, int x) {
  int p = (idx << 1), q = p + 1, c = (a + b) >> 1, d = c + 1;
  if (a == l && b == r) lazy[idx] += x;
  push(idx, a, b);
  if (a == l && b == r) return;
  if (r <= c) {
    push(q, d, b);
    update_rmq(p, a, c, l, r, x);
  } else if (l >= d) {
    push(p, a, c);
    update_rmq(q, d, b, l, r, x);
  } else {
    update_rmq(p, a, c, l, c, x);
    update_rmq(q, d, b, d, r, x);
  }
  tree[idx] = ((tree[p]) + (tree[q]));
}
int query_tree(int u, int l) {
  int res = 0;
  while (height[u] > height[l]) {
    if (num[u]) {
      int v = ((num[u] == 0) ? -1 : down[up[u]]);
      if (height[v] <= height[l]) v = down[l];
      res = ((res) + (query_rmq(1, 1, id, num[v], num[u])));
      u = parent[v];
    } else
      res = ((nodeval[u]) + (res)), u = parent[u];
  }
  return res;
}
int query(int u, int v) {
  int l = lca(u, v), res = 0;
  res = ((res) + (query_tree(u, l)));
  res = ((res) + (query_tree(v, l)));
  if (!num[l])
    res = ((nodeval[l]) + (res));
  else
    res = ((query_rmq(1, 1, id, num[l], num[l])) + (res));
  return res;
}
void update_tree(int u, int l, int w) {
  while (height[u] > height[l]) {
    if (num[u]) {
      int v = ((num[u] == 0) ? -1 : down[up[u]]);
      if (height[v] <= height[l]) v = down[l];
      update_rmq(1, 1, id, num[v], num[u], w);
      u = parent[v];
    } else
      nodeval[u] = ((nodeval[u]) + (w)), u = parent[u];
  }
}
void update(int u, int v, int w) {
  int l = lca(u, v);
  update_tree(u, l, w);
  update_tree(v, l, w);
  if (!num[l])
    nodeval[l] = ((nodeval[l]) + (w));
  else
    update_rmq(1, 1, id, num[l], num[l], w);
}
}  // namespace hld
int n, q;
vector<int> adj[M];
int dp[M][303];
int a[M];
int anc[M];
void solve() {
  int k, g, r;
  vector<pair<long long, long long> > vec;
  cin >> k >> g >> r;
  r--;
  for (int i = 1; i <= k; i++) {
    int x;
    cin >> x;
    x--;
    int lca = hld::lca(x, r);
    int lvl = hld::height[r] + hld::height[x] - 2 * hld::height[lca];
    vec.push_back(make_pair(lvl, x));
    anc[i - 1] = 0;
  }
  sort(vec.begin(), vec.end());
  for (int i = 0; i <= k - 1; i++) {
    int x = vec[i].second;
    anc[i] = hld::query(r, x);
    hld::update(x, x, 1);
  }
  for (int i = 0; i <= k - 1; i++) {
    int x = vec[i].second;
    hld::update(x, x, -1);
  }
  for (int i = 0; i <= k - 1; i++)
    for (int j = 0; j <= 300; j++) dp[i][j] = 0;
  int ses = 0;
  dp[0][1] = 1;
  for (int i = 1; i <= k - 1; i++) {
    for (int j = 1; j <= g; j++) {
      dp[i][j] = ad(dp[i][j], dp[i - 1][j - 1]);
      if (j - anc[i] <= 0) continue;
      int z = gun(dp[i - 1][j], j - anc[i]);
      dp[i][j] = ad(dp[i][j], z);
    }
  }
  for (int i = 1; i <= g; i++) {
    ses = ad(ses, dp[k - 1][i]);
  }
  cout << ses << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> q;
  hld::init(n, a);
  for (int i = 1; i <= n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    hld::add_edge(u, v);
  }
  hld::build();
  while (q--) {
    solve();
  }
  return 0;
}
