#include <bits/stdc++.h>
using std::max;
using std::min;
using std::sort;
using std::swap;
template <typename T>
void read(T &x) {
  int flag = 1;
  x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') flag = -flag;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  x *= flag;
}
const int N = 3e3 + 10, P = 1e9 + 7;
int n, d, f[N][N], cnt, from[N], to[N], nxt[N];
int qpow(int a, int b) {
  int ret = 1;
  for (; b; b >>= 1, a = 1ll * a * a % P)
    if (b & 1) ret = 1ll * ret * a % P;
  return ret;
}
inline void addEdge(int u, int v) {
  to[++cnt] = v, nxt[cnt] = from[u], from[u] = cnt;
}
void dfs(int u) {
  for (int i = 1; i <= n; ++i) f[u][i] = 1;
  for (int i = from[u]; i; i = nxt[i]) {
    int v = to[i];
    dfs(v);
    for (int j = 1; j <= n; ++j) f[u][j] = 1ll * f[u][j] * f[v][j] % P;
  }
  for (int i = 1; i <= n; ++i) (f[u][i] += f[u][i - 1]) %= P;
}
int calc() {
  if (d <= n) return f[1][d];
  int o = (n & 1) ? -1 : 1, tmp = 1, ans = 0;
  for (int i = 1; i <= n; ++i) tmp = 1ll * tmp * (d - i) % P;
  for (int i = 1; i <= n; ++i) tmp = 1ll * tmp * qpow(i, P - 2) % P;
  for (int i = 0; i <= n; ++i, o = -o) {
    ans = (ans + 1ll * o * f[1][i] % P * tmp % P) % P;
    tmp = 1ll * tmp * (d - i) % P * qpow(d - i - 1, P - 2) % P;
    tmp = 1ll * tmp * (n - i) % P * qpow(i + 1, P - 2) % P;
  }
  return (ans + P) % P;
}
int main() {
  read(n), read(d);
  for (int i = 2, fa; i <= n; ++i) read(fa), addEdge(fa, i);
  dfs(1);
  if (d <= n) return printf("%d\n", f[1][d]), 0;
  printf("%d\n", calc());
  return 0;
}
