#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int n, d;
int head[3050], cnt;
long long f[3050][3050];
long long pre[3050], suf[3050], fac[3050];
struct data {
  int next, to;
  data(int next = 0, int to = 0) : next(next), to(to) {}
} edge[3050 << 1];
void connect(int u, int v) {
  edge[++cnt] = data(head[u], v);
  head[u] = cnt;
}
int read() {
  char c = getchar();
  int x = 0;
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) {
    x = (x << 3) + (x << 1) + c - '0';
    c = getchar();
  }
  return x;
}
void DFS(int u, int pre) {
  for (int i = 1; i <= n; ++i) f[u][i] = 1;
  for (int i = head[u]; i; i = edge[i].next) {
    int v = edge[i].to;
    if (v == pre) continue;
    DFS(v, u);
    for (int j = 1; j <= n; ++j) f[u][j] = f[u][j] * f[v][j] % mod;
  }
  for (int i = 1; i <= n; ++i) f[u][i] = (f[u][i - 1] + f[u][i]) % mod;
}
long long power(long long a, int b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return res;
}
int solve() {
  DFS(1, 0);
  long long res = 0, val = 1;
  if (d <= n) return f[1][d];
  for (int i = 1; i <= n; ++i)
    val = val * power(i, mod - 2) % mod * (d - i) % mod;
  for (int i = 0; i <= n; ++i) {
    res = (res + ((n - i) & 1 ? -1 : 1) * f[1][i] * val % mod + mod) % mod;
    val = val * (d - i) % mod * power(d - i - 1, mod - 2) % mod * (n - i) %
          mod * power(i + 1, mod - 2) % mod;
  }
  return (int)res;
}
int main() {
  n = read();
  d = read();
  for (int i = 2; i <= n; ++i) {
    int f = read();
    connect(f, i);
  }
  int ans = solve();
  printf("%d\n", ans);
}
