#include <bits/stdc++.h>
using namespace std;
const int N = 3005;
const int mod = 1e9 + 7;
int n, D, f[N][N], dp[N][N], g[N][N], ways[N][N];
vector<int> adj[N];
void dfs(int u) {
  for (int k = 0; k <= n + 1; k++) f[0][k] = 1;
  int sz = adj[u].size() - 1;
  for (int i = 1; i < adj[u].size(); i++) {
    int v = adj[u][i];
    dfs(v);
  }
  for (int i = 1; i < adj[u].size(); i++) {
    int v = adj[u][i];
    for (int k = 1; k <= n + 1; k++) {
      dp[i][k] = 1ll * dp[i - 1][k] * g[v][k] % mod;
      (dp[i][k] += 1ll * f[i - 1][k - 1] * ways[v][k] % mod) %= mod;
      f[i][k] = (f[i][k - 1] + dp[i][k]) % mod;
    }
  }
  for (int k = 1; k <= n + 1; k++) {
    if (sz) {
      ways[u][k] = (dp[sz][k] + f[sz][k - 1]) % mod;
      g[u][k] = (g[u][k - 1] + ways[u][k]) % mod;
    } else {
      g[u][k] = k;
      ways[u][k] = 1;
    }
  }
}
int Power(int x, int n) {
  if (!n) return 1;
  if (n % 2) return 1ll * Power(x, n - 1) * x % mod;
  int tmp = Power(x, n / 2);
  return 1ll * tmp * tmp % mod;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> D;
  for (int i = 1; i <= n; i++) adj[i].push_back(0);
  for (int i = 2; i <= n; i++) {
    int p;
    cin >> p;
    adj[p].push_back(i);
  }
  dfs(1);
  if (D <= n + 1) return cout << g[1][D], 0;
  vector<int> _div(n + 1);
  for (int i = 1; i <= n; i++) _div[i] = Power(i, mod - 2);
  int res = 0;
  for (int i = 1; i <= n + 1; i++) {
    int cur = g[1][i];
    for (int j = 1; j < i; j++) {
      cur = 1ll * cur * (D - j) % mod;
      cur = 1ll * cur * _div[i - j] % mod;
    }
    for (int j = i + 1; j <= n + 1; j++) {
      cur = 1ll * cur * (D - j) % mod;
      cur = 1ll * cur * _div[j - i] % mod;
    }
    if ((n + 1 - i) & 1) cur = mod - cur;
    res = (res + cur) % mod;
    if (res < 0) res += mod;
  }
  cout << res;
}
