#include <bits/stdc++.h>
using std::max;
using std::min;
using std::sort;
using std::swap;
template <typename T>
void read(T &x) {
  int flag = 1;
  x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') flag = -flag;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  x *= flag;
}
const int N = 3e3 + 10, P = 1e9 + 7;
int n, d, f[N][N], cnt, from[N], to[N], nxt[N];
int pre[N], suf[N], fac[N], inv[N];
int qpow(int a, int b) {
  int ret = 1;
  for (; b; b >>= 1, a = 1ll * a * a % P)
    if (b & 1) ret = 1ll * ret * a % P;
  return ret;
}
inline void addEdge(int u, int v) {
  to[++cnt] = v, nxt[cnt] = from[u], from[u] = cnt;
}
void dfs(int u) {
  for (int i = 1; i <= n; ++i) f[u][i] = 1;
  for (int i = from[u]; i; i = nxt[i]) {
    int v = to[i];
    dfs(v);
    for (int j = 1; j <= n; ++j) f[u][j] = 1ll * f[u][j] * f[v][j] % P;
  }
  for (int i = 1; i <= n; ++i) (f[u][i] += f[u][i - 1]) %= P;
}
int main() {
  read(n), read(d);
  for (int i = 2, fa; i <= n; ++i) read(fa), addEdge(fa, i);
  dfs(1);
  if (d <= n) return printf("%d\n", f[1][d]), 0;
  int ret = 0;
  pre[0] = d, suf[n + 1] = fac[0] = 1;
  for (int i = 1; i <= n; ++i) pre[i] = 1ll * pre[i - 1] * (d - i) % P;
  for (int i = n; i >= 1; --i) suf[i] = 1ll * suf[i + 1] * (d - i) % P;
  for (int i = 1; i <= n; ++i) fac[i] = 1ll * fac[i - 1] * i % P;
  inv[n] = qpow(fac[n], P - 2);
  for (int i = n; i >= 1; --i) inv[i - 1] = 1ll * inv[i] * i % P;
  for (int i = 1; i <= n; ++i) {
    int s1 = 1ll * pre[i - 1] * suf[i + 1] % P;
    int s2 = 1ll * inv[i] * inv[n - i] % P;
    int tmp = 1ll * s1 * s2 % P * f[1][i] % P;
    if ((n - i) & 1)
      ret = (ret + P - 1ll * s1 * s2 % P * f[1][i] % P) % P;
    else
      ret = (ret + 1ll * s1 * s2 % P * f[1][i] % P) % P;
  }
  printf("%d\n", ret);
  return 0;
}
