#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 3e3 + 10;
vector<int> g[N];
long long f[N][N], x[N], y[N];
int n, D, son[N], vis[N];
long long quickpow(long long x, long long k) {
  long long res = 1;
  while (k) {
    if (k & 1) res = res * x % mod;
    x = x * x % mod;
    k >>= 1;
  }
  return res;
}
long long Lagrange(long long goal, int p) {
  for (int i = 1; i <= p; i++) {
    y[i] = f[1][i];
  }
  long long res = 0;
  for (int i = 1; i <= p; i++) {
    long long s1 = 1, s2 = 1;
    for (int j = 1; j <= p; j++) {
      if (j == i) continue;
      s1 = s1 * (goal - x[j]) % mod;
      s2 = s2 * (x[i] - x[j]) % mod;
    }
    s1 = s1 * y[i] % mod * quickpow(s2, mod - 2) % mod;
    res = res + s1 % mod;
  }
  return res;
}
void dfs1(int u, int fa) {
  if (vis[u]) return;
  vis[u] = 1;
  for (int i = 1; i <= n + 1; i++) {
    long long s = 1;
    for (int j = 0; j < (int)g[u].size(); j++) {
      int to = g[u][j];
      if (to == fa) continue;
      dfs1(to, u);
      s = s * f[to][i] % mod;
    }
    f[u][i] = (f[u][i] + s + f[u][i - 1]) % mod;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> D;
  for (int i = 2; i <= n; i++) {
    int t;
    cin >> t;
    g[t].push_back(i);
    g[i].push_back(t);
  }
  for (int i = 1; i <= n + 1; i++) x[i] = i;
  dfs1(1, 0);
  cout << (Lagrange(D, n + 1) % mod + mod) % mod << endl;
  return 0;
}
