#include <bits/stdc++.h>
using namespace std;
const int maxN = 3e3 + 5;
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
int C[maxN][maxN];
int dp[maxN][maxN];
int res[maxN], ans = 0;
vector<int> G[maxN];
int modP(int a, int b) {
  if (b == 0) return 1;
  int c = modP(a, b / 2);
  c = (1ll * c * c) % MOD;
  if (b & 1) c = (1ll * a * c) % MOD;
  return c;
}
void DFS(int v) {
  dp[v][1] = 1;
  for (auto u : G[v]) DFS(u);
  for (int j = 2; j < maxN; j++) {
    int tmp = 1;
    for (auto u : G[v]) {
      tmp = (1ll * tmp * dp[u][j]) % MOD;
    }
    dp[v][j] = (dp[v][j - 1] + tmp) % MOD;
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  C[0][0] = 1;
  for (int i = 1; i < maxN; i++) {
    C[i][0] = C[i][i] = 1;
    for (int j = 1; j < i; j++) C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % MOD;
  }
  int n, d;
  scanf("%d%d", &n, &d);
  for (int i = 2; i <= n; i++) {
    int inp;
    scanf("%d", &inp);
    G[inp].push_back(i);
  }
  DFS(1);
  int comb = 1;
  for (int i = 1; i <= min(n, d); i++) {
    res[i] = dp[1][i];
    for (int j = 1; j < i; j++)
      res[i] = (MOD + (long long)res[i] - 1ll * C[i][j] * res[j] % MOD) % MOD;
    comb = (1ll * comb * (d - i + 1)) % MOD;
    comb = (1ll * comb * modP(i, MOD - 2)) % MOD;
    ans = (ans + 1ll * res[i] * comb % MOD) % MOD;
  }
  printf("%d", ans);
  return 0;
}
