#include <bits/stdc++.h>
const int N = 3103;
const int MOD = 1e9 + 7;
struct Node {
  long long x, y;
};
int n, D, m;
int top, fi[N], ne[N << 1], to[N << 1];
long long f[N][N];
Node node[N << 1];
void add(int u, int v);
void DFS(int t);
long long lagrange(long long x);
long long inv(long long t);
long long ksm(long long x, long long y);
int main() {
  scanf("%d%d\n", &n, &D);
  m = n + 1;
  for (int i = (int)2; i <= (int)n; ++i) {
    int p;
    scanf("%d", &p);
    add(p, i);
  }
  DFS(1);
  for (int i = (int)1; i <= (int)m; ++i) node[i] = (Node){i, f[1][i]};
  printf("%lld\n", (lagrange(D) + MOD) % MOD);
  return 0;
}
void add(int u, int v) { ne[++top] = fi[u], fi[u] = top, to[top] = v; }
void DFS(int t) {
  for (int i = (int)1; i <= (int)m; ++i) f[t][i] = 1;
  for (int i = fi[t]; i; i = ne[i]) {
    DFS(to[i]);
    for (int j = (int)1; j <= (int)m; ++j) (f[t][j] *= f[to[i]][j]) %= MOD;
  }
  for (int i = (int)1; i <= (int)m; ++i) (f[t][i] += f[t][i - 1]) %= MOD;
}
long long lagrange(long long x) {
  long long res = 0;
  for (int i = (int)1; i <= (int)m; ++i) {
    long long u = 1, d = 1;
    for (int j = (int)1; j <= (int)m; ++j) {
      if (i == j) continue;
      (u *= x - node[j].x) %= MOD;
      (d *= node[i].x - node[j].x) %= MOD;
    }
    (res += (node[i].y * ((u * inv(d)) % MOD)) % MOD) %= MOD;
  }
  return res;
}
long long inv(long long t) { return ksm(t, MOD - 2); }
long long ksm(long long x, long long y) {
  long long res = 1;
  while (y) {
    if (y & 1) (res *= x) %= MOD;
    (x *= x) %= MOD;
    y >>= 1;
  }
  return res;
}
