#include <bits/stdc++.h>
using namespace std;
struct Lagrange {
  int n, m;
  vector<int> Inv, Den;
  Lagrange(int n, int m) : n(n), m(m), Inv(n, 1), Den(n, 1) {
    assert(n > 1);
    for (int i = 2; i < n; i++)
      Inv[i] = 1LL * (m - m / i) * Inv[m % i] % m,
      Den[i] = 1LL * Den[i - 1] * Inv[i] % m;
  }
  constexpr int inv(int x) {
    return x < 2 ? x : 1LL * (m - m / x) * inv(m % x) % m;
  }
  constexpr int sub(long long x, int y) { return (x - y + m) % m; }
  constexpr int add(int x, int y) { return (x + y) % m; }
  template <typename T>
  int interp(const vector<T> &X, const vector<T> &Y, int x) {
    int ans = 0;
    for (size_t i = 0; i < X.size(); i++) {
      int num = Y.at(i), den = 1;
      for (size_t j = 0; j < X.size(); j++)
        if (j != i)
          num = 1LL * num * sub(x, X[j]) % m,
          den = 1LL * den * sub(X[i], X[j]) % m;
      ans = add(ans, 1LL * num * inv(den) % m);
    }
    return ans;
  }
  template <typename T>
  int interp_fast(const vector<T> &Y, long long x) {
    int k = (int)Y.size() - 1;
    assert(k < n);
    if (x <= k) return Y[x] % m;
    vector<int> Suf(1, 1);
    for (int j = k, tmp = 1; j > 0; j--)
      Suf.push_back(tmp = 1LL * tmp * sub(x, j) % m);
    int ans = 0, den = Den[k];
    for (int j = 0, pref = 1; j <= k; j++) {
      int num = 1LL * pref * Suf.back() % m;
      pref = 1LL * pref * sub(x, j) % m, Suf.pop_back();
      int t = 1LL * num * den % m * Y[j] % m;
      ans = (k - j) & 1 ? sub(ans, t) : add(ans, t);
      if (j < k) den = 1LL * den * Inv[j + 1] % m * (k - j) % m;
    }
    return ans;
  }
};
using LL = long long;
LL F[3005][3005];
int main() {
  LL n, D;
  cin >> n >> D;
  const int Mod = 1e9 + 7;
  vector<vector<int>> G(n + 1);
  for (int i = 2; i <= n; i++) {
    int x;
    scanf("%d", &x);
    G[x].push_back(i);
  }
  function<void(int)> dfs = [&](int u) {
    for (auto v : G[u]) {
      dfs(v);
    }
    for (int i = 1; i <= min(n, D); i++) {
      LL tmp = 1;
      for (auto v : G[u]) {
        tmp = tmp * F[v][i] % Mod;
      }
      F[u][i] = (F[u][i - 1] + tmp) % Mod;
    }
  };
  dfs(1);
  vector<LL> Y;
  for (int i = 0; i <= n; i++) Y.push_back(F[1][i]);
  Lagrange lg(n + 1, Mod);
  cout << lg.interp_fast(Y, D) << endl;
}
