#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const int MAXN = 3100;
int parent[MAXN];
const int MOD = 1e9 + 7;
long long pow_mod(long long v, long long p) {
  if (p == 0) return 1;
  long long res = pow_mod((v * v) % MOD, p / 2);
  if (p & 1) res = (res * v) % MOD;
  return res;
}
long long inverse(long long v) { return pow_mod(v, MOD - 2); }
long long inverse_mem[MAXN];
long long get_inverse(int v) {
  if (v < 0) return -get_inverse(-v);
  if (inverse_mem[v] == -1) inverse_mem[v] = inverse(v);
  return inverse_mem[v];
}
vector<long long> poly_interpol(vector<long long> x, vector<long long> y) {
  for (int i = (1); i < (int((x).size())); i++) {
    for (int j = int(int((x).size())) - 1; j >= (i); j--) {
      y[j] = ((y[j] - y[j - 1]) * get_inverse(x[j] - x[j - i])) % MOD;
    }
  }
  return y;
}
long long poly_eval(vector<long long> x, vector<long long> c, long long xval) {
  int n = int((x).size()) - 1;
  long long yval = c[n];
  for (int i = int(n) - 1; i >= (0); i--) {
    yval = (c[i] + (xval - x[i]) * yval) % MOD;
  }
  if (yval < 0) yval += MOD;
  return yval;
}
long long dp[MAXN][MAXN];
int main() {
  for (int i = (0); i < (MAXN); i++) inverse_mem[i] = -1;
  int N, D;
  if (0 == scanf("%d%d", &N, &D)) {
    fprintf(stderr, "Could not parse arguments\n");
  };
  parent[0] = -1;
  for (int i = (1); i < (N); i++) {
    if (0 == scanf("%d", parent + i)) {
      fprintf(stderr, "Could not parse arguments\n");
    };
    --parent[i];
  }
  int L = min(D + 1, N + 2);
  for (int n = (0); n < (N); n++)
    for (int i = (0); i < (L); i++) dp[n][i] = (i > 0);
  for (int n = int(N) - 1; n >= (0); n--) {
    for (int i = (1); i < (L); i++) dp[n][i] = (dp[n][i] + dp[n][i - 1]) % MOD;
    if (parent[n] != -1) {
      for (int i = (0); i < (L); i++)
        dp[parent[n]][i] = (dp[parent[n]][i] * dp[n][i]) % MOD;
    }
  }
  vector<long long> x(L), y(L);
  for (int i = (0); i < (L); i++) x[i] = i;
  for (int i = (0); i < (L); i++) y[i] = dp[0][i];
  auto c = poly_interpol(x, y);
  cout << poly_eval(x, c, D) << endl;
  return 0;
}
