#include <bits/stdc++.h>
using namespace std;
const int MN = 3000 + 100, mod = 1e9 + 7;
int dp[MN][MN];
vector<int> adj[MN];
int n;
void dfs(int v) {
  for (int u : adj[v]) {
    dfs(u);
  }
  for (int i = 1; i <= n; i++) {
    int x = 1;
    for (int u : adj[v]) {
      x = (1ll * x * dp[u][i]) % mod;
    }
    dp[v][i] = (dp[v][i - 1] + x) % mod;
  }
}
int rev[MN];
int powm(int x, int y) {
  if (rev[x]) {
    return rev[x];
  }
  if (y == 0) {
    return 1;
  }
  int ans = powm(x, y / 2);
  ans = (1ll * ans * ans % mod);
  if (y & 1) {
    ans = (1ll * ans * x) % mod;
  }
  return rev[x] = ans;
}
int main() {
  ios::sync_with_stdio(0);
  int d;
  cin >> n >> d;
  for (int i = 1; i < n; i++) {
    int p;
    cin >> p;
    p--;
    adj[p].push_back(i);
  }
  dfs(0);
  int ncr = 1;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int ncr1 = 1;
    for (int j = 1; j < i; j++) {
      ncr1 = (((1ll * ncr1 * (i - j + 1)) % mod) * powm(j, mod - 2)) % mod;
      dp[0][i] = (dp[0][i] + mod - 1ll * ncr1 * dp[0][j] % mod) % mod;
    }
    ncr = (((1ll * ncr * (d - i + 1)) % mod) * powm(i, mod - 2)) % mod;
    ans = (ans + 1ll * ncr * dp[0][i]) % mod;
  }
  cout << ans;
}
