Allen, having graduated from the MOO Institute of Techcowlogy (MIT), has started a startup! Allen is the president of his startup. He also hires n-1 other employees, each of which is assigned a direct superior. If u is a superior of v and v is a superior of w then also u is a superior of w. Additionally, there are no u and v such that u is the superior of v and v is the superior of u. Allen himself has no superior. Allen is employee number 1, and the others are employee numbers 2 through n.

Finally, Allen must assign salaries to each employee in the company including himself. Due to budget constraints, each employee's salary is an integer between 1 and D. Additionally, no employee can make strictly more than his superior.

Help Allen find the number of ways to assign salaries. As this number may be large, output it modulo 10^9 + 7.

Input

The first line of the input contains two integers n and D (1 ≤ n ≤ 3000, 1 ≤ D ≤ 10^9).

The remaining n-1 lines each contain a single positive integer, where the i-th line contains the integer p_i (1 ≤ p_i ≤ i). p_i denotes the direct superior of employee i+1.

Output

Output a single integer: the number of ways to assign salaries modulo 10^9 + 7.

Examples

Input

3 2
1
1


Output

5


Input

3 3
1
2


Output

10


Input

2 5
1


Output

15

Note

In the first sample case, employee 2 and 3 report directly to Allen. The three salaries, in order, can be (1,1,1), (2,1,1), (2,1,2), (2,2,1) or (2,2,2).

In the second sample case, employee 2 reports to Allen and employee 3 reports to employee 2. In order, the possible salaries are (1,1,1), (2,1,1), (2,2,1), (2,2,2), (3,1,1), (3,2,1), (3,2,2), (3,3,1), (3,3,2), (3,3,3).
#include <bits/stdc++.h>
const bool DEBUG = false;
using namespace std;
const long long maxn = 3e3 + 5;
const long long INF = 1e18 + 1;
const long long M = 1e9 + 7;
const int lg = 21;
long long n, D, ans, f[maxn], rf[maxn], DP[maxn], dp[maxn][maxn];
vector<int> c[maxn];
inline long long POW(long long a, long long b) {
  if (b == 0) return 1;
  long long p = POW(a, b >> 1);
  p = p * p % M;
  if (b & 1) p = p * a % M;
  return p;
}
inline long long C(long long n, long long k) {
  if (k > n) return 0;
  return f[n] * rf[k] % M * rf[n - k] % M;
}
inline long long C_kharaki(long long D, long long k) {
  long long a = 1, b = 1;
  for (int i = 0; i < k; i++) a = a * D % M, D--;
  for (int i = 1; i <= k; i++) b = b * i % M;
  return a * POW(b, M - 2) % M;
}
inline void dfs(int v) {
  for (auto u : c[v]) dfs(u);
  dp[v][1] = 1;
  for (int i = 2; i <= n; i++) {
    long long ans = 1;
    dp[v][i] = dp[v][i - 1];
    for (auto u : c[v]) ans = ans * dp[u][i] % M;
    dp[v][i] = (dp[v][i] + ans) % M;
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> D;
  f[0] = rf[0] = 1;
  for (int i = 1; i < maxn; i++)
    f[i] = f[i - 1] * i % M, rf[i] = rf[i - 1] * POW(i, M - 2) % M;
  for (int i = 1; i <= n - 1; i++) {
    int x;
    cin >> x, x--;
    c[x].push_back(i);
  }
  dfs(0);
  DP[1] = 1;
  for (int i = 2; i <= n; i++) {
    DP[i] = dp[0][i];
    for (int j = 1; j < i; j++) DP[i] = (DP[i] - DP[j] * C(i, j) % M + M) % M;
  }
  for (int i = 1; i <= n; i++) ans = (ans + C_kharaki(D, i) * DP[i]) % M;
  cout << ans << endl;
  return 0;
}
