#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXN = 3000;
const int MOD = 1000000007;
int n, mxsal;
int par[MAXN];
int inv[MAXN + 1];
int dp[MAXN][MAXN + 2];
void inc(int &a, int b) {
  if ((a += b) >= MOD) a -= MOD;
}
void mlt(int &a, int b) { a = (long long)a * b % MOD; }
int solve() {
  for (int i = (0); i < (n); ++i)
    for (int j = (1); j <= (n + 1); ++j) dp[i][j] = 1;
  for (int i = n - 1; i >= 0; --i) {
    for (int j = (2); j <= (n + 1); ++j) inc(dp[i][j], dp[i][j - 1]);
    if (par[i] != -1)
      for (int j = (1); j <= (n + 1); ++j) mlt(dp[par[i]][j], dp[i][j]);
  }
  if (mxsal <= n + 1) return dp[0][mxsal];
  inv[1] = 1;
  for (int i = (2); i <= (n); ++i)
    inv[i] = (long long)(MOD - MOD / i) * inv[MOD % i] % MOD;
  int ret = 0;
  for (int i = (1); i <= (n + 1); ++i) {
    int cur = 1;
    for (int j = (1); j <= (n + 1); ++j)
      if (i != j) {
        mlt(cur, mxsal - j);
        mlt(cur, i > j ? inv[i - j] : MOD - inv[j - i]);
      }
    ret = (ret + (long long)cur * dp[0][i]) % MOD;
  }
  return ret;
}
void run() {
  scanf("%d%d", &n, &mxsal);
  par[0] = -1;
  for (int i = (1); i < (n); ++i) scanf("%d", &par[i]), --par[i];
  printf("%d\n", solve());
}
int main() {
  run();
  return 0;
}
