#include <bits/stdc++.h>
using namespace std;
const int N = 3e3 + 7, M = 6e3 + 7, p = 1e9 + 7;
int n, d, val[N], f[N][M], ifac[N];
vector<int> v[N];
bool fl[N];
inline int read() {
  int num = 0;
  char g = getchar();
  while (g < 48 || 57 < g) g = getchar();
  while (47 < g && g < 58)
    num = (num << 1) + (num << 3) + g - 48, g = getchar();
  return num;
}
inline int inc(int a, int b) {
  if (a + b >= p) return a + b - p;
  return a + b;
}
inline int mul(int a, int b) { return 1ll * a * b % p; }
inline int pows(int u, int v) {
  int ans = 1;
  while (v > 0) {
    if (v & 1) ans = mul(ans, u);
    u = mul(u, u), v = v >> 1;
  }
  return ans;
}
inline void find(int u) {
  int len = v[u].size();
  fl[u] = 1;
  for (int x = 1; x <= n * 2; x++) f[u][x] = 1;
  for (int i = 0; i < len; i++) {
    int x = v[u][i];
    if (fl[x]) continue;
    find(x);
    for (int c = 1; c <= n * 2; c++) f[u][c] = mul(f[u][c], f[x][c]);
  }
  for (int i = 1; i <= n * 2; i++) f[u][i] = inc(f[u][i], f[u][i - 1]);
}
int main() {
  n = read(), d = read();
  int u, t;
  ifac[0] = 1;
  for (int i = 1; i <= n * 2; i++) ifac[i] = mul(ifac[i - 1], pows(i, p - 2));
  for (int i = 2; i <= n; i++)
    u = read(), t = i, v[u].push_back(t), v[t].push_back(u);
  find(1);
  int sum = 0;
  for (int i = 1; i <= n * 2; i++) {
    int val = mul(mul(mul(f[1][i], ifac[n * 2 - i]), ifac[i - 1]),
                  pows(p - 1, n * 2 - i));
    for (int j = 1; j <= n * 2; j++) {
      if (i == j) continue;
      val = mul(val, d - j);
    }
    sum = inc(sum, val);
  }
  cout << (sum + p) % p << endl;
  return 0;
}
