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>
using namespace std;
const int N = 3000 + 5;
const int M = 3000 + 5;
const int MOD = 1e9 + 7;
const int CM = 998244353;
const int INF = 0x3f3f3f3f;
const double eps = 1e-6;
template <typename T>
T MAX(T a, T b) {
  return a > b ? a : b;
}
template <typename T>
T MIN(T a, T b) {
  return a > b ? b : a;
}
template <typename T>
T GCD(T a, T b) {
  return b == 0 ? a : GCD(b, a % b);
}
template <typename T>
T LCM(T a, T b) {
  return a / GCD(a, b) * b;
}
template <typename T>
T ABS(T a, T b) {
  return a > 0 ? a : -a;
}
template <typename T>
T ADD(T a, T b, T MOD) {
  return (a + b) % MOD;
}
template <typename T>
T DEL(T a, T b, T MOD) {
  return ((a - b) % MOD + MOD) % MOD;
}
struct Edge {
  int to, next;
} e[M << 1];
int head[N], tot;
void add(int u, int v) {
  e[++tot].to = v;
  e[tot].next = head[u];
  head[u] = tot;
}
long long dp[N][N];
long long pre[N];
long long a[N];
int n, d, m;
struct Lagrange {
  int n;
  int mod;
  long long y[N];
  void init(int n, int mod, long long *y) {
    this->n = n, this->mod = mod;
    for (int i = 1; i <= n; i++) this->y[i] = y[i];
  }
  long long pow(long long a, long long b, long long p) {
    long long ans = 1;
    a %= p;
    while (b) {
      if (b & 1) ans = ans * a % p;
      a = a * a % p;
      b >>= 1;
    }
    return ans;
  }
  inline long long add(long long x, long long y) {
    return x + y >= mod ? x + y - mod : x + y;
  }
  inline long long dec(long long x, long long y) {
    return x - y < 0 ? x - y + mod : x - y;
  }
  inline long long mul(long long x, long long y) { return x * y % mod; }
  long long pre[N], shuff[N];
  long long fac[N], inv[N];
  void Pre(int k) {
    pre[0] = 1, shuff[n + 1] = 1;
    fac[0] = 1;
    for (int i = 1; i <= n; i++) pre[i] = mul(pre[i - 1], dec(k, i));
    for (int i = n; i >= 1; i--) shuff[i] = mul(shuff[i + 1], dec(k, i));
    for (int i = 1; i <= n; i++) fac[i] = mul(fac[i - 1], i);
    inv[n] = pow(fac[n], mod - 2, mod);
    for (int i = n - 1; i >= 0; i--) inv[i] = mul(inv[i + 1], i + 1);
  }
  long long cal(long long k) {
    Pre(k);
    long long ans = 0;
    for (int i = 1; i <= n; i++) {
      long long up = mul(pre[i - 1], shuff[i + 1]);
      long long down = mul(inv[i - 1], inv[n - i]);
      up = mul(y[i], up);
      up = mul(up, down);
      if ((n - i) % 2 == 0)
        ans = add(ans, up);
      else
        ans = dec(ans, up);
    }
    return ans;
  }
} lagrange;
void dfs(int u, int fath) {
  for (int j = 1; j <= m; j++) dp[u][j] = 1;
  for (int i = head[u]; i; i = e[i].next) {
    int v = e[i].to;
    if (v == fath) continue;
    dfs(v, u);
    pre[0] = 0;
    for (int j = 1; j <= m; j++) pre[j] = (pre[j - 1] + dp[v][j]) % MOD;
    for (int j = 1; j <= m; j++) dp[u][j] = dp[u][j] * pre[j] % MOD;
  }
}
void solve() {
  scanf("%d%d", &n, &d);
  m = n + 1;
  for (int i = 1; i < n; i++) {
    int p;
    scanf("%d", &p);
    add(i + 1, p);
    add(p, i + 1);
  }
  dfs(1, 0);
  a[0] = 0;
  for (int i = 1; i <= m; i++) a[i] = (a[i - 1] + dp[1][i]) % MOD;
  lagrange.init(m, MOD, a);
  printf("%lld\n", lagrange.cal(d));
}
void TIME() {
  clock_t start, finish;
  double totaltime;
  start = clock();
  solve();
  finish = clock();
  totaltime = (double)(finish - start) / CLOCKS_PER_SEC;
  printf("\nTime:%lfms\n", totaltime * 1000);
}
int main() {
  solve();
  return 0;
}
