#include <bits/stdc++.h>
using namespace ::std;
const long long maxn = 3100;
const long long mod = 1e9 + 7;
const long long inf = 1e9 + 500;
long long fac[maxn];
long long rfac[maxn];
long long poww(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) {
      ans = (ans * a) % mod;
    }
    a = (a * a) % mod;
    b = (b / 2);
  }
  return ans;
}
long long ent(long long n, long long k) {
  if (k < 0 || k > n) {
    return 0;
  }
  return (((fac[n] * rfac[k]) % mod) * rfac[n - k]) % mod;
}
void hesab() {
  fac[0] = 1;
  rfac[0] = 1;
  for (long long i = 1; i < maxn; i++) {
    fac[i] = (fac[i - 1] * i) % mod;
    rfac[i] = poww(fac[i], mod - 2);
  }
}
vector<long long> bach[maxn];
long long dp[maxn][maxn];
void dfs(long long a) {
  for (auto v : bach[a]) {
    dfs(v);
  }
  for (long long i = 1; i < maxn; i++) {
    dp[a][i] = 1;
    for (auto v : bach[a]) {
      dp[a][i] *= dp[v][i];
      dp[a][i] %= mod;
    }
  }
  for (long long i = 1; i < maxn; i++) {
    dp[a][i] = (dp[a][i] + dp[a][i - 1]) % mod;
  }
}
long long s[maxn];
int main() {
  hesab();
  long long n, D;
  cin >> n >> D;
  for (long long i = 2; i <= n; i++) {
    long long v;
    cin >> v;
    bach[v].push_back(i);
  }
  dfs(1);
  for (long long i = 1; i <= n; i++) {
    s[i] = dp[1][i];
  }
  for (long long i = 2; i <= n; i++) {
    for (long long j = 1; j < i; j++) {
      s[i] -= (s[j] * ent(i, j)) % mod;
      ;
    }
    s[i] %= mod;
    s[i] += mod;
    s[i] %= mod;
  }
  long long ans = 0;
  long long res = 1;
  for (long long i = 1; i <= n; i++) {
    res *= (D - i + 1);
    res %= mod;
    res *= poww(i, mod - 2);
    res %= mod;
    ans += (res * s[i]) % mod;
    ans %= mod;
  }
  cout << ans;
}
