#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;
}
