#include <bits/stdc++.h>
using namespace std;
long long qpow(long long x, long long y) {
  long long ret = 1;
  for (; y; y >>= 1, x = x * x % 1000000007)
    if (y & 1) ret = ret * x % 1000000007;
  return ret;
}
long long t, n, m, k, x[1000005], y[1000005], fac[1000005], pre[1000005],
    suf[1000005], a[1000005], dp[3005][3005];
long long lagrange(long long k) {
  fac[0] = pre[0] = suf[n + 1] = 1;
  for (long long i = 1; i <= n; i++)
    fac[i] = fac[i - 1] * i % 1000000007,
    pre[i] = pre[i - 1] * (k - x[i] + 1000000007) % 1000000007;
  for (long long i = n; i >= 1; i--)
    suf[i] = suf[i + 1] * (k - x[i] + 1000000007) % 1000000007;
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    long long pi = pre[x[i] - 1] * suf[x[i] + 1] % 1000000007;
    long long ha = fac[x[i] - 1] * fac[n - x[i]] % 1000000007;
    if ((n - i) & 1) ha = (1000000007 - ha) % 1000000007;
    pi = pi * qpow(ha, 1000000007 - 2) % 1000000007;
    ans = (ans + y[i] * pi % 1000000007) % 1000000007;
  }
  return ans;
}
struct edge {
  long long v, nxt;
} e[1000005 << 1];
long long p[1000005], eid;
void init() {
  memset(p, -1, sizeof p);
  eid = 0;
}
void insert(long long u, long long v) {
  e[eid].v = v;
  e[eid].nxt = p[u];
  p[u] = eid++;
}
void dfs(long long u, long long fa) {
  for (long long i = 1; i <= n; i++) dp[u][i] = 1;
  for (long long i = p[u]; i + 1; i = e[i].nxt) {
    long long v = e[i].v;
    if (v == fa) continue;
    dfs(v, u);
    for (long long j = 1; j <= n; j++)
      dp[u][j] = dp[u][j] * dp[v][j] % 1000000007;
  }
  for (long long i = 2; i <= n; i++)
    dp[u][i] = (dp[u][i] + dp[u][i - 1]) % 1000000007;
}
signed main() {
  init();
  scanf("%lld%lld", &n, &m);
  for (long long i = 2; i <= n; i++) {
    long long u = i, v = 0;
    scanf("%d", &v);
    insert(u, v);
    insert(v, u);
  }
  n++;
  dfs(1, 1);
  for (long long i = 1; i <= n; i++) x[i] = i, y[i] = dp[1][i];
  printf("%lld\n", lagrange(m));
  return 0;
}
