#include <bits/stdc++.h>
using namespace std;
const int inf = 0x7fffffff;
const double eps = 1e-10;
const double pi = acos(-1.0);
inline int read() {
  int x = 0, f = 1;
  char ch;
  ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = 0;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch & 15);
    ch = getchar();
  }
  if (f)
    return x;
  else
    return -x;
}
const int N = 3030;
const long long mod = 1e9 + 7;
long long power(long long a, long long b) {
  long long ans = 1ll;
  for (; b; b >>= 1, a = a * a % mod)
    if (b & 1ll) ans = ans * a % mod;
  return ans;
}
int n;
long long D;
vector<int> G[N];
long long f[N][N];
void dfs(int u) {
  for (int i = 1; i <= n + 1; i++) f[u][i] = 1;
  for (int i = 0; i < G[u].size(); i++) {
    dfs(G[u][i]);
    for (int j = 1; j <= n + 1; j++) f[u][j] = (f[u][j] * f[G[u][i]][j]) % mod;
  }
  for (int x = 1; x <= n + 1; x++) f[u][x] = (f[u][x] + f[u][x - 1]) % mod;
}
long long pre[N], suf[N], fac[N];
long long Lagrange(long long *y, long long n, long long k) {
  long long top, bot, ret = 0, Fac;
  pre[0] = suf[n + 1] = Fac = 1ll;
  for (long long i = 1; i <= n; i++)
    pre[i] = (pre[i - 1] * (k - i + mod) % mod) % mod;
  for (long long i = n; i >= 1; i--)
    suf[i] = (suf[i + 1] * (k - i + mod) % mod) % mod;
  for (long long i = 2; i <= n; i++) Fac = Fac * i % mod;
  fac[n] = power(Fac, mod - 2);
  for (int i = n - 1; i >= 0; i--) fac[i] = fac[i + 1] * 1ll * (i + 1) % mod;
  for (int i = 1; i <= n; i++) {
    top = (pre[i - 1] * suf[i + 1] % mod) % mod,
    bot = (fac[i - 1] * fac[n - i] % mod) % mod;
    if ((n - i) & 1)
      ret = (ret - (y[i] * top % mod * bot % mod) + mod) % mod;
    else
      ret = (ret + (y[i] * top % mod * bot % mod)) % mod;
  }
  return (ret + mod) % mod;
}
int main() {
  n = read();
  scanf("%I64d", &D);
  D %= mod;
  for (int i = 2, a; i <= n; i++) a = read(), G[a].push_back(i);
  dfs(1);
  if (D <= 1ll * n + 1ll)
    printf("%I64d\n", f[1][D]);
  else
    printf("%I64d\n", Lagrange(f[1], n + 1, D));
  return 0;
}
