#include <bits/stdc++.h>
using namespace std;
const int N = 3005, MOD = 1000000007;
template <typename T>
void read(T &x) {
  bool neg = false;
  unsigned char c = getchar();
  for (; (c ^ 48) > 9; c = getchar())
    if (c == '-') neg = true;
  for (x = 0; (c ^ 48) < 10; c = getchar()) x = (x << 3) + (x << 1) + (c ^ 48);
  if (neg) x = -x;
}
struct line {
  int next, to;
} e[N];
int n, d, hd[N], cnt, f[N][N], ans;
void adline(int u, int v) {
  e[cnt].to = v;
  e[cnt].next = hd[u];
  hd[u] = cnt++;
}
void dfs(int u) {
  for (int i = 0, i_end = n + 1; i < i_end; ++i) f[u][i] = 1;
  for (int i = hd[u]; ~i; i = e[i].next) {
    int v = e[i].to;
    dfs(v);
    for (int i = 0, i_end = n + 1; i < i_end; ++i)
      f[u][i] = (long long)f[u][i] * f[v][i] % MOD;
  }
  for (int i = 1, i_end = n + 1; i < i_end; ++i)
    f[u][i] = (f[u][i] + f[u][i - 1]) % MOD;
}
int inv(int aa) {
  int b = MOD - 2;
  long long a = aa, c = 1;
  while (b) {
    if (b & 1) c = c * a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
  return (int)c;
}
int main() {
  read(n);
  read(d);
  --d;
  for (int i = 0, i_end = n; i < i_end; ++i) hd[i] = -1;
  for (int i = 1, i_end = n; i < i_end; ++i) {
    int p;
    read(p);
    adline(--p, i);
  }
  dfs(0);
  for (int i = 0, i_end = n + 1; i < i_end; ++i) {
    int tmp = f[0][i];
    long long div = 1;
    for (int j = 0, j_end = n + 1; j < j_end; ++j)
      if (j != i) div = div * (i - j) % MOD;
    tmp = (long long)tmp * inv((int)div) % MOD;
    for (int j = 0, j_end = n + 1; j < j_end; ++j)
      if (j != i) tmp = (long long)tmp * (d - j) % MOD;
    ans = (ans + tmp) % MOD;
  }
  ans += MOD;
  ans %= MOD;
  printf("%d\n", ans);
  return 0;
}
