#include <bits/stdc++.h>
using namespace std;
const int N = 3010, size = 1 << 20, mod = (int)1e9 + 7, inf = 2e9;
const long long INF = 1e15;
template <class o>
void qr(o& x) {
  char c = getchar();
  x = 0;
  int f = 1;
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  x *= f;
}
template <class o>
void qw(o x) {
  if (x / 10) qw(x / 10);
  putchar(x % 10 + '0');
}
template <class o>
void pr1(o x) {
  if (x < 0) x = -x, putchar('-');
  qw(x);
  putchar(' ');
}
template <class o>
void pr2(o x) {
  if (x < 0) x = -x, putchar('-');
  qw(x);
  putchar('\n');
}
template <class o>
void cmax(o& x, o y) {
  if (x < y) x = y;
}
template <class o>
void cmin(o& x, o y) {
  if (x > y) x = y;
}
int n, D, d[N], mx, f[N][N];
long long power(long long a, long long b = mod - 2) {
  long long c = 1;
  while (b) {
    if (b & 1) c = c * a % mod;
    b >>= 1;
    a = a * a % mod;
  }
  return c;
}
struct LA {
  int n, y[N];
  int& operator[](int i) { return y[i]; }
  long long operator()(long long k) {
    long long ans = 0;
    for (int i = 1; i <= n; i++) {
      long long a = y[i], b = 1;
      for (int j = 1; j <= n; j++)
        if (i ^ j) a = a * (k - j) % mod, b = b * (i - j) % mod;
      ans = (ans + a * power(b)) % mod;
    }
    return (ans + mod) % mod;
  }
} g;
int fa[N];
void solve() {
  qr(n);
  qr(D);
  for (int i = 2; i <= n; i++) {
    qr(fa[i]);
  }
  g.n = mx = n + 5;
  for (int i = 1; i <= n; i++) fill(f[i] + 1, f[i] + mx + 1, 1);
  for (int i = n; i >= 1; i--) {
    long long b = 0;
    for (int j = 1; j <= mx; j++) {
      b = (b + f[i][j]) % mod;
      f[fa[i]][j] = b * f[fa[i]][j] % mod;
    }
  }
  for (int i = 1; i <= mx; i++) g[i] = f[1][i] = (f[1][i] + f[1][i - 1]) % mod;
  pr2(g(D));
}
int main() {
  int T = 1;
  while (T--) solve();
  return 0;
}
