#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
inline T read() {
  register T sum(0), fg(1);
  register char ch(getchar());
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') fg = -1;
  for (; isdigit(ch); ch = getchar()) sum = (sum << 3) + (sum << 1) + ch - '0';
  return sum * fg;
}
const int MOD = (int)1e9 + 7;
const int MAXN = (int)3e3, MAXD = (int)1e9;
inline int fpm(int x, int y) {
  int res = 1;
  for (; y; y >>= 1, x = (long long)x * x % MOD)
    if (y & 1) res = (long long)res * x % MOD;
  return res;
}
int fac[MAXN + 5], ifac[MAXN + 5];
inline void MATH_init() {
  fac[0] = 1;
  for (int i = 1; i <= MAXN; ++i) fac[i] = (long long)fac[i - 1] * i % MOD;
  ifac[MAXN] = fpm(fac[MAXN], MOD - 2);
  for (int i = MAXN - 1; ~i; --i)
    ifac[i] = (long long)ifac[i + 1] * (i + 1) % MOD;
}
inline int C(int n0, int m0) {
  return n0 < m0 ? 0
                 : (long long)fac[n0] * ifac[n0 - m0] % MOD * ifac[m0] % MOD;
}
int n, D;
int fa[MAXN + 5];
vector<int> adj[MAXN + 5];
inline void input() {
  n = read<int>(), D = read<int>();
  for (int i = 2; i <= n; ++i) adj[fa[i] = read<int>()].push_back(i);
}
int dp[MAXN + 5][MAXN + 5], prefix[MAXN + 5][MAXN + 5];
inline void DP(int u) {
  for (auto v : adj[u]) DP(v);
  for (int i = 1; i <= n; ++i) dp[u][i] = 1;
  for (auto v : adj[u])
    for (int i = 1; i <= n; ++i)
      dp[u][i] = (long long)dp[u][i] * prefix[v][i] % MOD;
  for (int i = 1; i <= n; ++i)
    prefix[u][i] = (prefix[u][i - 1] + dp[u][i]) % MOD;
}
inline void solve() {
  MATH_init();
  DP(1);
  static int f[MAXN + 5], g[MAXN + 5];
  for (int i = 1; i <= n; ++i) f[i] = dp[1][i];
  for (int i = 1; i <= n; ++i) {
    g[i] = f[i];
    for (int j = 1; j < i; ++j)
      (g[i] -= (long long)C(i - 1, j - 1) * g[j] % MOD) %= MOD;
  }
  int ans = 0, C0 = 1;
  for (int i = 1; i <= n; ++i) {
    C0 = (long long)C0 * (D - i + 1) % MOD * fpm(i, MOD - 2) % MOD;
    (ans += (long long)C0 * g[i] % MOD) %= MOD;
  }
  printf("%d\n", (ans + MOD) % MOD);
}
int main() {
  input();
  solve();
  return 0;
}
