#include <bits/stdc++.h>
using namespace std;
const int maxn = 5005, maxe = maxn, P = 1e9 + 7;
int n, D, a[maxn];
int fir[maxn], nxt[maxe], son[maxe], tot;
void add(int x, int y) {
  son[++tot] = y;
  nxt[tot] = fir[x];
  fir[x] = tot;
}
int f[maxn][maxn], mdep[maxn], sum[maxn], g[maxn], v[maxn];
long long fac[maxn], inv[maxn], fac_inv[maxn];
long long Pow(long long a, long long b) {
  long long res = 1;
  for (; b; b >>= 1, a = a * a % P)
    if (b & 1) res = res * a % P;
  return res;
}
long long C(int n, int m) {
  return fac[n] * fac_inv[m] % P * fac_inv[n - m] % P;
}
long long _C(int n, int m) {
  long long res = 1;
  for (int i = n - m + 1; i <= n; i++) res = res * i % P;
  return res * fac_inv[m] % P;
}
void dfs(int x) {
  for (int j = fir[x]; j; j = nxt[j]) dfs(son[j]);
  v[0] = 0;
  for (int j = fir[x]; j; j = nxt[j]) v[++v[0]] = son[j];
  for (int i = 1; i <= n; i++) {
    f[x][i] = 1;
    for (int j = 1; j <= v[0]; j++)
      f[x][i] = (long long)f[x][i] * f[v[j]][i] % P;
    (f[x][i] += f[x][i - 1]) %= P;
  }
}
int main() {
  scanf("%d%d", &n, &D);
  fac[0] = 1;
  for (int i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % P;
  inv[1] = 1;
  for (int i = 2; i <= n; i++) inv[i] = (long long)(P - P / i) * inv[P % i] % P;
  fac_inv[0] = 1;
  for (int i = 1; i <= n; i++) fac_inv[i] = fac_inv[i - 1] * inv[i] % P;
  for (int i = 2; i <= n; i++) {
    int x;
    scanf("%d", &x);
    add(x, i);
  }
  dfs(1);
  for (int i = 1, t = 0; i <= n; i++) {
    g[i] = f[1][i];
    for (int j = 1; j <= i - 1; j++) (g[i] -= C(i, j) * g[j] % P) %= P;
  }
  int ans = 0;
  for (int i = 1; i <= n && i <= D; i++) (ans += _C(D, i) * g[i] % P) %= P;
  printf("%d\n", (ans + P) % P);
  return 0;
}
