#include <bits/stdc++.h>
using namespace std;
inline int read() {
  char ch = getchar();
  int nega = 1;
  while (!isdigit(ch)) {
    if (ch == '-') nega = -1;
    ch = getchar();
  }
  int ans = 0;
  while (isdigit(ch)) {
    ans = ans * 10 + ch - 48;
    ch = getchar();
  }
  if (nega == -1) return -ans;
  return ans;
}
void print(vector<int> x) {
  for (int i = 0; i < (int)x.size(); i++)
    printf("%d%c", x[i], " \n"[i == (int)x.size() - 1]);
}
inline int add(int x, int y) {
  return x + y >= 1000000007 ? x + y - 1000000007 : x + y;
}
inline int add(int x, int y, int z) { return add(add(x, y), z); }
inline int sub(int x, int y) { return x - y < 0 ? x - y + 1000000007 : x - y; }
inline int mul(int x, int y) { return 1LL * x * y % 1000000007; }
inline int mul(int x, int y, int z) { return mul(mul(x, y), z); }
int qpow(int x, int y) {
  int ans = 1;
  while (y) {
    if (y & 1) ans = mul(ans, x);
    x = mul(x, x);
    y >>= 1;
  }
  return ans;
}
int Inv(int x) { return qpow(x, 1000000007 - 2); }
int f[5055][5055], g[5055][5055], fa[5055], n, m = 5050, D;
vector<int> G[5055];
int fac[5055], inv[5055], pinv[5055];
void init() {
  fac[0] = 1;
  for (int i = 1; i < 5055; i++) fac[i] = mul(fac[i - 1], i);
  inv[0] = inv[1] = 1;
  for (int i = 2; i < 5055; i++)
    inv[i] = mul(1000000007 - 1000000007 / i, inv[1000000007 % i]);
  pinv[0] = 1;
  for (int i = 1; i < 5055; i++) pinv[i] = mul(pinv[i - 1], inv[i]);
}
void dfs(int u) {
  for (int v : G[u]) dfs(v);
  for (int i = 1; i <= m; i++) {
    f[u][i] = 1;
    for (int v : G[u]) f[u][i] = mul(f[u][i], g[v][i]);
  }
  for (int i = 1; i <= m; i++) g[u][i] = add(g[u][i - 1], f[u][i]);
}
signed main() {
  n = read(), D = read();
  init();
  for (int i = 2; i <= n; i++) {
    int u = read();
    G[u].push_back(i);
  }
  dfs(1);
  if (D <= m) {
    printf("%d\n", g[1][D]);
    return 0;
  }
  int prd = 1, ans = 0;
  for (int i = 1; i <= m; i++) prd = mul(prd, D - i);
  for (int i = 1; i <= m; i++) {
    int cur = mul(prd, Inv(D - i), g[1][i]);
    int x = mul(pinv[i - 1], pinv[m - i]);
    if ((m - i) & 1) x = sub(0, x);
    ans = add(ans, mul(cur, x));
  }
  cout << ans << endl;
  return 0;
}
