#include <bits/stdc++.h>
using namespace std;
const int N = 3010;
const int P = 1000000007;
int n, D;
vector<int> G[N];
int f[N][N], s[N][N], C[N][N], g[N], inv[N];
void dfs(int u) {
  for (int j = 1; j <= n; ++j) {
    f[u][j] = 1;
  }
  for (auto v : G[u]) {
    dfs(v);
    for (int j = 1; j <= n; ++j) {
      f[u][j] = 1ll * f[u][j] * s[v][j] % P;
    }
  }
  for (int j = 1; j <= n; ++j) {
    s[u][j] = (s[u][j - 1] + f[u][j]) % P;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> D;
  for (int i = 2; i <= n; ++i) {
    int x;
    cin >> x;
    G[x].emplace_back(i);
  }
  dfs(1);
  C[0][0] = C[1][0] = C[1][1] = 1;
  for (int i = 2; i <= n; ++i) {
    C[i][0] = 1;
    for (int j = 1; j <= i; ++j) {
      C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % P;
    }
  }
  for (int i = 1; i <= n; ++i) {
    g[i] = f[1][i];
    for (int j = 1; j < i; ++j) {
      int tmp = (1ll * C[i - 1][j - 1] * g[j]) % P;
      g[i] = ((g[i] - tmp) % P + P) % P;
    }
  }
  int ans = 0;
  inv[0] = inv[1] = 1;
  for (int i = 2; i <= n; ++i) {
    inv[i] = 1ll * (P - P / i) * inv[P % i] % P;
  }
  for (int i = 2; i <= n; ++i) {
    inv[i] = 1ll * inv[i - 1] * inv[i] % P;
  }
  for (int i = 1; i <= min(n, D); ++i) {
    int res = inv[i];
    for (int j = D - i + 1; j <= D; ++j) {
      res = 1ll * res * j % P;
    }
    ans = (ans + (1ll * res * g[i]) % P) % P;
  }
  cout << ans << '\n';
  return 0;
}
