#include <bits/stdc++.h>
using namespace std;
long long f[3010][3010], a[3010];
inline long long read() {
  long long x = 0;
  char ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x;
}
inline long long Pow(long long a, long long b, long long p = 1000000007) {
  long long res = 1;
  for (; b; b >>= 1, a = 1LL * a * a % p)
    if (b & 1) res = 1LL * res * a % p;
  return res;
}
long long tot = 1;
long long fir[3010 << 1], nex[3010 << 1], got[3010 << 1];
inline void AddEdge(long long x, long long y) {
  nex[++tot] = fir[x], fir[x] = tot, got[tot] = y;
}
inline void dfs(long long x, long long fa, long long n) {
  for (long long i = 1; i <= n + 1; i++) f[x][i] = 1;
  for (long long i = fir[x]; i; i = nex[i]) {
    long long y = got[i], s = 0;
    if (y == fa) continue;
    dfs(y, x, n);
    for (long long j = 1; j <= n + 1; j++) {
      (s += f[y][j]) %= 1000000007, (f[x][j] *= s) %= 1000000007;
    }
  }
}
signed main() {
  long long n = read(), d = read();
  for (long long i = 2; i <= n; i++) {
    long long x = read();
    AddEdge(i, x), AddEdge(x, i);
  }
  dfs(1, 0, n);
  long long ans = 0;
  for (long long i = 1; i <= n + 1; i++)
    a[i] = (a[i - 1] + f[1][i]) % 1000000007;
  for (long long i = 1; i <= n + 1; i++) {
    long long A = a[i], B = 1;
    for (long long j = 1; j <= n + 1; j++) {
      if (i == j) continue;
      (A *= (d - j + 1000000007) % 1000000007) %= 1000000007;
      (B *= (i - j + 1000000007) % 1000000007) %= 1000000007;
    }
    (ans += A * Pow(B, 1000000007 - 2) % 1000000007) %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
