#include <bits/stdc++.h>
using namespace std;
inline int gi() {
  int f = 1, sum = 0;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    sum = (sum << 3) + (sum << 1) + ch - '0';
    ch = getchar();
  }
  return f * sum;
}
const int N = 3010, Mod = 1e9 + 7;
int n, D, f[N][N];
vector<int> G[N];
void dfs(int u, int ff) {
  for (int i = 1; i <= n; i++) f[u][i] = 1;
  for (int v : G[u]) {
    if (v == ff) continue;
    dfs(v, u);
    for (int i = 1; i <= n; i++) f[u][i] = 1ll * f[u][i] * f[v][i] % Mod;
  }
  for (int i = 1; i <= n; i++) f[u][i] = (f[u][i - 1] + f[u][i]) % Mod;
}
int qpow(int a, int b) {
  int ret = 1;
  while (b) {
    if (b & 1) ret = 1ll * ret * a % Mod;
    b >>= 1;
    a = 1ll * a * a % Mod;
  }
  return ret;
}
int solve(int D) {
  int ans = 0, G = 1, res = (n & 1) ? Mod - 1 : 1;
  for (int i = 0; i <= n; i++) res = 1ll * res * (D - i) % Mod;
  for (int i = 1; i <= n; i++) res = 1ll * res * qpow(i, Mod - 2) % Mod;
  ;
  for (int i = 0; i <= n; i++, G = Mod - G) {
    int ret = 1ll * G * f[1][i] % Mod * res % Mod;
    ans = (ans + 1ll * ret * qpow(D - i, Mod - 2) % Mod) % Mod;
    res = 1ll * res * qpow(i + 1, Mod - 2) % Mod;
    res = 1ll * res * (n - i) % Mod;
  }
  return ans;
}
int main() {
  n = gi();
  D = gi();
  for (int i = 2; i <= n; i++) G[gi()].push_back(i);
  dfs(1, 1);
  if (D <= n)
    printf("%d\n", f[1][D]);
  else
    printf("%d\n", solve(D));
  return 0;
}
