#include <bits/stdc++.h>
inline long long read() {
  char c = getchar();
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  long long k = 0, kk = 1;
  if (c == '-') c = getchar(), kk = -1;
  while (c >= '0' && c <= '9') k = k * 10 + c - '0', c = getchar();
  return k * kk;
}
void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x / 10) write(x / 10);
  putchar(x % 10 + '0');
}
void writeln(long long x) {
  write(x);
  puts("");
}
using namespace std;
long long n, q, nn, f[3100][3100], ff[3100], gg[3100], jc[3100], N[3100];
long long last[3100], a[10010][2], kk, x;
void dfs(long long x) {
  for (long long i = 1; i <= nn; i++) f[x][i] = 1;
  for (long long i = last[x]; i; i = a[i][0]) {
    dfs(a[i][1]);
    for (long long j = 1; j <= nn; j++)
      (f[x][j] *= f[a[i][1]][j]) %= 1000000007;
  }
  for (long long i = 1; i <= nn; i++) (f[x][i] += f[x][i - 1]) %= 1000000007;
}
void doit(long long x, long long y) {
  a[++kk][0] = last[x];
  a[kk][1] = y;
  last[x] = kk;
}
long long ksm(long long x, long long y) {
  long long ans = 1;
  while (y) {
    if (y & 1) (ans *= x) %= 1000000007;
    (x *= x) %= 1000000007;
    y >>= 1;
  }
  return ans;
}
long long clc(long long x) {
  if (x <= nn) return f[1][x];
  jc[0] = 1;
  for (long long i = 1; i <= nn; i++) jc[i] = jc[i - 1] * i % 1000000007;
  N[nn] = ksm(jc[nn], 1000000007 - 2);
  for (long long i = nn; i >= 1; i--) N[i - 1] = N[i] * i % 1000000007;
  ff[0] = 1;
  gg[nn + 1] = 1;
  long long sum = 0;
  for (long long i = 1; i <= nn; i++) ff[i] = ff[i - 1] * (x - i) % 1000000007;
  for (long long i = nn; i >= 1; i--) gg[i] = gg[i + 1] * (x - i) % 1000000007;
  for (long long i = 1; i <= nn; i++) {
    long long dd = ff[i - 1] * gg[i + 1] % 1000000007;
    long long ddd = N[i - 1] * N[nn - i] % 1000000007;
    if ((nn - i) & 1) ddd = 1000000007 - ddd;
    (sum += dd * ddd % 1000000007 * f[1][i]) %= 1000000007;
  }
  return sum;
}
signed main() {
  n = read();
  q = read();
  nn = n + 10;
  for (long long i = 1; i < n; i++) x = read(), doit(x, i + 1);
  dfs(1);
  writeln(clc(q));
}
