#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int ret = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  do {
    ret = ret * 10 + ch - '0';
    ch = getchar();
  } while ('0' <= ch && ch <= '9');
  return ret;
}
inline void write(int x) {
  if (!x) return;
  write(x / 10);
  putchar(x % 10 + '0');
}
inline long long fpow(long long x, long long a) {
  long long ret = 1;
  while (a) {
    if (a & 1) ret = ret * x % 1000000007;
    a >>= 1;
    x = x * x % 1000000007;
  }
  return ret;
}
inline long long ni(long long x) { return fpow(x, 1000000007 - 2); }
int n;
long long m;
struct node {
  int v;
  node *nxt;
} e[2 * 3010], *h[3010];
int z;
inline void addedge(int u, int v) {
  e[++z].v = v;
  e[z].nxt = h[u];
  h[u] = &e[z];
}
int dp[3010][2 * 3010];
long long he[3010][2 * 3010];
void dfs(int x, int fa) {
  for (node *p = h[x]; p; p = p->nxt) dfs(p->v, x);
  for (int i = 1; i <= 2 * n; i++) {
    dp[x][i] = 1;
    for (node *p = h[x]; p; p = p->nxt)
      dp[x][i] = dp[x][i] * he[p->v][i] % 1000000007;
    he[x][i] = (he[x][i - 1] + dp[x][i]) % 1000000007;
  }
}
int ny[2 * 3010];
inline int Ni(int x) { return x > 0 ? ny[x] : -ny[-x]; }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  for (int i = 1; i <= 6000; i++) ny[i] = ni(i);
  cin >> n >> m;
  for (int i = 0, u; i < n - 1; i++) {
    cin >> u;
    addedge(u, i + 2);
  }
  dfs(1, 0);
  long long Ans = 0;
  for (int i = 1; i <= 2 * n; i++) {
    long long res = 1;
    for (int j = 1; j <= 2 * n; j++)
      if (i != j) res = res * (m - j) % 1000000007 * Ni(i - j) % 1000000007;
    Ans = (Ans + he[1][i] * res) % 1000000007;
  }
  Ans = (Ans + 1000000007) % 1000000007;
  cout << Ans << endl;
  return 0;
}
