#include <bits/stdc++.h>
using namespace std;
long long n, m, k;
long long read() {
  long long s = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    s = s * 10 + ch - '0';
    ch = getchar();
  }
  return s * f;
}
inline void print(long long *f, long long len) {
  for (long long i = 0; i < len; i++) printf("%lld ", f[i]);
  puts("");
}
long long d;
const long long maxm = 6e3 + 10;
long long head[maxm], to[maxm], nxt[maxm], fa[maxm];
const long long mod = 1e9 + 7;
long long qpow(long long a, long long b = mod - 2) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return ans;
}
const long long dXnmsl = 3333;
long long f[dXnmsl][dXnmsl];
signed main() {
  n = read(), d = read();
  for (long long i = 2, iend = n; i <= iend; ++i) {
    long long x = read();
    fa[i] = x;
  }
  for (long long i = 1, iend = n; i <= iend; ++i) {
    for (long long j = 1, jend = n + 1; j <= jend; ++j) f[i][j] = 1;
  }
  for (long long i = n, iend = 1; i >= iend; --i) {
    for (long long j = 2, jend = n + 1; j <= jend; ++j)
      f[i][j] += f[i][j - 1], f[i][j] %= mod;
    if (i != 1) {
      for (long long j = 1, jend = n + 1; j <= jend; ++j)
        f[fa[i]][j] *= f[i][j], f[fa[i]][j] %= mod;
    }
  }
  for (long long i = 2, iend = n + 1; i <= iend; ++i) {
    for (long long j = 1, jend = n + 2 - i; j <= jend; ++j) {
      f[i][j] = f[i - 1][j + 1] - f[i - 1][j] + mod, f[i][j] %= mod;
    }
  }
  long long ans = 0;
  long long nw = 1;
  for (long long i = 1, iend = min(n + 1, d); i <= iend; ++i) {
    ans += nw * f[i][1] % mod;
    ans %= mod;
    nw *= (d - i);
    nw %= mod;
    nw *= qpow(i);
    nw %= mod;
  }
  cout << ans;
}
