Problem: You are given a tree with n nodes and q queries.

Every query starts with three integers k, m and r, followed by k nodes of the tree a_1, a_2, …, a_k. To answer a query, assume that the tree is rooted at r. We want to divide the k given nodes into at most m groups such that the following conditions are met: 

  * Each node should be in exactly one group and each group should have at least one node. 
  * In any group, there should be no two distinct nodes such that one node is an ancestor (direct or indirect) of the other. 



You need to output the number of ways modulo 10^{9}+7 for every query.

Input

The first line contains two integers n and q (1 ≤ n, q ≤ 10^{5}) — the number of vertices in the tree and the number of queries, respectively.

Each of the next n-1 lines contains two integers u and v (1 ≤ u, v ≤ n, u ≠ v), denoting an edge connecting vertex u and vertex v. It is guaranteed that the given graph is a tree.

Each of the next q lines starts with three integers k, m and r (1 ≤ k, r ≤ n, 1 ≤ m ≤ min(300,k)) — the number of nodes, the maximum number of groups and the root of the tree for the current query, respectively. They are followed by k distinct integers a_1, a_2, …, a_k (1 ≤ a_i ≤ n), denoting the nodes of the current query.

It is guaranteed that the sum of k over all queries does not exceed 10^{5}.

Output

Print q lines, where the i-th line contains the answer to the i-th query.

Examples

Input


7 2
5 4
2 6
5 3
1 2
7 5
4 6
3 3 2 7 4 3
3 1 4 6 2 1


Output


2
0


Input


7 2
4 7
2 5
4 1
5 1
5 6
4 3
3 3 2 7 1 4
2 1 6 3 2


Output


1
1


Input


5 2
3 5
4 5
4 2
1 4
2 2 3 1 2
2 2 4 5 4


Output


2
1

Note

Consider the first example.

In the first query, we have to divide the three given nodes (7, 4 and 3), into the maximum of three groups assuming that the tree is rooted at 2. When the tree is rooted at 2, 4 is an ancestor of both 3 and 7. So we can't put all the nodes into one group. There is only 1 way to divide the given nodes into two groups, which are [4] and [3, 7]. Also, there is only one way to divide the given nodes into three groups, which are [7], [4] and [3]. So, there are total 2 ways to divide the given nodes into a maximum of three groups.

In the second query, when the tree is rooted at 4, 6 is an ancestor of 2 and 2 is an ancestor of 1. So, we can't put all the given nodes into one group.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int top = 0;
int N, Q, NN;
int K, M, R;
vector<int> Adj[100005];
int dep[100005];
int anc[100005][21];
int pre[100005], pst[100005], tt;
void dfs(int u) {
  pre[u] = ++tt;
  for (int j = 1; j <= 20; j++) {
    if (dep[u] <= (1 << j)) break;
    anc[u][j] = anc[anc[u][j - 1]][j - 1];
  }
  int v;
  for (int k = 0; k < Adj[u].size(); k++) {
    v = Adj[u][k];
    if (v == anc[u][0]) continue;
    anc[v][0] = u;
    dep[v] = dep[u] + 1;
    dfs(v);
  }
  pst[u] = ++tt;
}
int lca(int u, int v) {
  if (dep[u] < dep[v]) swap(u, v);
  for (int j = 20; j >= 0; j--) {
    if (dep[anc[u][j]] >= dep[v]) {
      u = anc[u][j];
    }
  }
  if (u == v) return u;
  for (int j = 20; j >= 0; j--) {
    if (anc[u][j] != anc[v][j]) {
      u = anc[u][j];
      v = anc[v][j];
    }
  }
  return anc[u][0];
}
int h[100005], c[2 * 100005];
int lbt(int x) { return x & (-x); }
void update(int x, int dv) {
  for (; x <= NN; x += lbt(x)) {
    c[x] += dv;
  }
}
int getsum(int x) {
  int ans = 0;
  for (; x > 0; x -= lbt(x)) {
    ans += c[x];
  }
  return ans;
}
bool cmp(const int& a, const int& b) { return dep[a] < dep[b]; }
int query(int u, int lca) { return getsum(pre[u] - 1) - getsum(pre[lca] - 1); }
int a[100005];
bool vis[100005];
long long dp[100005][305];
int work() {
  int u, z;
  for (int i = 1; i <= K; i++) {
    u = a[i];
    update(pre[u], 1);
    update(pst[u], -1);
    vis[a[i]] = 1;
  }
  int x;
  for (int i = 1; i <= K; i++) {
    u = a[i];
    z = lca(u, R);
    if (u == R)
      h[i] = 0;
    else if (u == z)
      h[i] = query(R, u) - (vis[u] == true) + (vis[R] == true);
    else if (z == R)
      h[i] = query(u, R);
    else
      h[i] = query(u, z) + query(R, z) - (vis[z] == true) + (vis[R] == true);
  }
  sort(h + 1, h + 1 + K);
  dp[1][1] = 1;
  for (int i = 2; i <= K; i++) {
    for (int j = 1; j <= M; j++) {
      if (j > h[i])
        dp[i][j] = ((long long)dp[i - 1][j] * (j - h[i]) % int(1e9 + 7) +
                    dp[i - 1][j - 1]) %
                   int(1e9 + 7);
      else
        dp[i][j] = 0;
    }
  }
  long long ans = 0;
  for (int j = 1; j <= M; j++) {
    ans = (ans + dp[K][j]) % int(1e9 + 7);
  }
  for (int i = 1; i <= K; i++) {
    u = a[i];
    update(pre[u], -1);
    update(pst[u], +1);
    vis[a[i]] = 0;
  }
  return ans;
}
int main() {
  scanf("%d%d", &N, &Q);
  int u, v;
  for (int i = 1; i < N; i++) {
    scanf("%d%d", &u, &v);
    Adj[u].push_back(v);
    Adj[v].push_back(u);
  }
  dep[1] = 1;
  dfs(1);
  NN = 2 * N;
  while (Q--) {
    scanf("%d%d%d", &K, &M, &R);
    for (int i = 1; i <= K; i++) {
      scanf("%d", &a[i]);
    }
    printf("%d\n", work());
  }
  return 0;
}