#include <bits/stdc++.h>
using namespace std;
const int N = 3030;
const int mod = 1e9 + 7;
int n, D;
int f[N][N];
int c[N][N];
vector<int> g[N];
long long binpow(long long u, long long v) {
  long long ans = 1;
  while (v) {
    if (v & 1) ans = (ans * u) % mod;
    u = (u * u) % mod;
    v >>= 1;
  }
  return ans;
}
void add(int &u, int v) {
  u += v;
  if (u >= mod) u -= mod;
}
void dfs(int u, int p = 0) {
  for (int i = 1; i <= n; ++i) {
    f[u][i] = 1;
  }
  for (int v : g[u]) {
    if (v == p) continue;
    dfs(v, u);
    int sum = 0;
    for (int i = 1; i <= n; ++i) {
      add(sum, f[v][i]);
      f[u][i] = (1LL * f[u][i] * sum) % mod;
    }
  }
}
int main() {
  cin >> n >> D;
  for (int i = 1; i < n; ++i) {
    int u, v = i + 1;
    cin >> u;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1);
  for (int i = 0; i <= n; ++i) {
    c[i][0] = 1;
    for (int j = 1; j <= i; ++j) {
      c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
      c[i][j] %= mod;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = i - 1; j >= 1; --j) {
      f[1][i] -= (1LL * f[1][j] * c[i - 1][j - 1]) % mod;
      if (f[1][i] < 0) f[1][i] += mod;
    }
    if (D < i) break;
    long long mul = 1, divi = 1;
    for (int j = D; j > D - i; --j) {
      mul = (mul * j) % mod;
      divi = (divi * (D - j + 1)) % mod;
    }
    mul = mul * binpow(divi, mod - 2) % mod;
    mul = mul * f[1][i] % mod;
    ans += mul;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
