#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
int dp[3010][3010], DP[3010][3010], f[3010], fv[3010], n, D;
vector<int> adj[3010];
void dfs(int u) {
  for (int v : adj[u]) dfs(v);
  for (int i = 1; i <= n + 1; i++) {
    int val = 1;
    for (int v : adj[u]) val = 1LL * val * DP[v][i] % mod;
    dp[u][i] = val;
    DP[u][i] = DP[u][i - 1] + dp[u][i];
    if (DP[u][i] >= mod) DP[u][i] -= mod;
  }
}
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> D;
  for (int i = 2; i <= n; i++) {
    int x;
    cin >> x;
    adj[x].push_back(i);
  }
  dfs(1);
  for (int i = 1; i <= n + 1; i++) f[i] = DP[1][i];
  if (D <= n + 1) {
    cout << f[D] << endl;
    return 0;
  }
  int C = 1;
  fv[0] = 1;
  for (int i = 1; i <= n + 1; i++) {
    C = 1LL * C * (D - i) % mod;
    fv[i] = 1LL * fv[i - 1] * i % mod;
  }
  int ans = 0;
  for (int i = 1; i <= n + 1; i++) {
    int val = 1LL * power(fv[n + 1 - i], mod - 2, mod) *
              power(fv[i - 1], mod - 2, mod) % mod;
    val = 1LL * val * power(D - i, mod - 2, mod) % mod;
    val = 1LL * val * f[i] % mod;
    if ((n + 1 - i) & 1)
      ans = (ans + mod - val) % mod;
    else
      ans = (ans + val) % mod;
  }
  ans = 1LL * ans * C % mod;
  cout << ans << endl;
}
