#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = int(1e9) + 7;
struct num {
  static int modinv(int a, int m) {
    a %= m;
    assert(a);
    return a == 1 ? 1 : m - ll(modinv(m, a)) * m / a;
  }
  int v;
  num() : v(0) {}
  num(ll v_) : v(int(v_ % MOD)) {
    if (v < 0) v += MOD;
  }
  friend num inv(const num& n) {
    num r(modinv(n.v, MOD));
    assert((n * r) == num(1));
    return r;
  }
  friend bool operator==(const num& a, const num& b) { return a.v == b.v; }
  friend bool operator!=(const num& a, const num& b) { return !(a == b); }
  friend std::ostream& operator<<(std::ostream& o, const num& n) {
    return o << n.v;
  }
  num& operator+=(const num& o) {
    v += o.v;
    if (v >= MOD) v -= MOD;
    return *this;
  }
  num& operator-=(const num& o) {
    v -= o.v;
    if (v < 0) v += MOD;
    return *this;
  }
  num& operator*=(const num& o) {
    v = ll(v) * o.v % MOD;
    return *this;
  }
  num& operator/=(const num& o) { return *this *= inv(o); }
  friend num operator+(const num& a, const num& b) { return num(a) += b; }
  friend num operator-(const num& a, const num& b) { return num(a) -= b; }
  friend num operator*(const num& a, const num& b) { return num(a) *= b; }
  friend num operator/(const num& a, const num& b) { return num(a) /= b; }
};
num interp(const vector<num>& x, const vector<num>& y, num k) {
  assert(x.size() == y.size());
  int n = int(x.size());
  for (int i = 0; i < n; i++) {
    if (x[i] == k) return y[i];
  }
  num res = 0;
  for (int i = 0; i < n; i++) {
    num numer = 1;
    num denom = 1;
    for (int j = 0; j < n; j++) {
      if (i == j) continue;
      numer *= k - x[j];
      denom *= x[i] - x[j];
    }
    numer *= y[i];
    res += numer / denom;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  int n, D;
  cin >> n >> D;
  D--;
  vector<int> par(n);
  par[0] = -1;
  for (int i = 1; i < n; i++) {
    cin >> par[i];
    par[i]--;
  }
  int K = n + 1;
  vector<vector<num>> dp(n, vector<num>(K + 1, 1));
  for (int v = n - 1; v >= 0; v--) {
    for (int i = 0; i < K; i++) {
      dp[v][i + 1] += dp[v][i];
    }
    int p = par[v];
    if (p != -1) {
      for (int i = 0; i <= K; i++) {
        dp[p][i] *= dp[v][i];
      }
    }
  }
  vector<num> x(K + 1), y(K + 1);
  for (int i = 0; i <= K; i++) {
    x[i] = i;
    y[i] = dp[0][i];
  }
  cout << interp(x, y, num(D)) << '\n';
}
