#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 3020;
int t, n, m, bro[maxn], son[maxn], f[maxn][maxn], x[maxn], y[maxn], d;
long long ans, t1, t2;
long long qui(long long a, long long b) {
  long long s = 1;
  while (b) {
    if (b & 1LL) s = s * a % mod;
    a = a * a % mod;
    b >>= 1LL;
  }
  return s;
}
void dfs(int x) {
  for (register int i = 1; i <= m; ++i) f[x][i] = 1;
  for (register int i = son[x]; i; i = bro[i]) {
    dfs(i);
    int s = 0;
    for (register int j = 1; j <= m; ++j) {
      s = (s + f[i][j]) % mod;
      f[x][j] = 1LL * f[x][j] * s % mod;
    }
  }
}
int main() {
  scanf("%d%d", &n, &d);
  m = n + 4;
  for (register int i = 2; i <= n; ++i) {
    scanf("%d", &t);
    bro[i] = son[t], son[t] = i;
  }
  dfs(1);
  for (register int i = 1; i <= m; ++i) f[1][i] = (f[1][i] + f[1][i - 1]) % mod;
  for (register int i = 1; i <= m; ++i) x[i] = i, y[i] = f[1][i];
  for (register int i = 1; i <= m; ++i) {
    t1 = y[i], t2 = 1;
    for (register int j = 1; j <= m; ++j) {
      if (i == j) continue;
      t1 = t1 * (d - x[j] + mod) % mod;
      t2 = t2 * (x[i] - x[j] + mod) % mod;
    }
    t2 = (t2 % mod + mod) % mod;
    t1 = t1 * qui(t2, mod - 2) % mod;
    t1 = (t1 % mod + mod) % mod;
    ans = (ans + t1) % mod;
  }
  printf("%lld\n", ans);
  return 0;
}
