#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
long long binexp(long long a, long long b) {
  long long res = 1;
  for (; b; a = a * a % MOD, b >>= 1)
    if (b & 1) res = res * a % MOD;
  return res;
}
long long inv(long long a) { return binexp(a, MOD - 2); }
int n, D;
int p[3001];
long long dp[3001][3001];
long long iv[6002];
int main() {
  cin >> n >> D;
  for (int i = 1; i < n; i++) {
    cin >> p[i + 1];
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) dp[i][j] = 1;
  for (int i = n; i >= 1; i--) {
    for (int j = 1; j <= n; j++) {
      dp[i][j] = (dp[i][j] + dp[i][j - 1]) % MOD;
      if (p[i]) dp[p[i]][j] = dp[p[i]][j] * dp[i][j] % MOD;
    }
  }
  long long ans = 0;
  for (int i = -n; i <= n; i++) iv[i + 3001] = inv(i);
  for (int j = 0; j <= n; j++) {
    long long l = 1;
    for (int m = 0; m <= n; m++) {
      if (m == j) continue;
      l = l * (D - m) % MOD;
      l = l * iv[j - m + 3001] % MOD;
    }
    ans = (ans + (dp[1][j] * l % MOD)) % MOD;
  }
  if (ans < 0) ans += MOD;
  cout << ans << endl;
  return 0;
}
