#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
const long long INF64 = 1e18;
const long long MOD = 1e9 + 7;
const long long MOD9 = 1e9 + 9;
const long long MOD3 = 998244353;
const long long P = 37;
const long long mxn = 1000;
long long n;
vector<pair<long long, long long> > p;
long long pw(long long a, long long n) {
  if (n == 0) return 1;
  if (n % 2 == 0) {
    long long c = pw(a, n / 2);
    return (c * c) % MOD;
  } else {
    return (a * pw(a, n - 1)) % MOD;
  }
}
map<long long, long long> mp;
long long bk(long long x) {
  if (mp.count(x)) return mp[x];
  mp[x] = pw(x, MOD - 2);
  return mp[x];
}
long long l(long long i, long long x) {
  long long answ = 1;
  for (long long j = 0; j <= n; ++j) {
    if (j == i) continue;
    answ *= (x - p[j].first + MOD) % MOD;
    answ %= MOD;
  }
  for (long long j = 0; j <= n; ++j) {
    if (j == i) continue;
    answ *= bk((p[i].first - p[j].first + MOD) % MOD);
    answ %= MOD;
  }
  return answ;
}
long long L(long long x) {
  long long sum = 0;
  for (long long i = 0; i <= n; ++i) {
    sum += (p[i].second * l(i, x)) % MOD;
  }
  return sum % MOD;
}
vector<vector<long long> > g;
vector<vector<long long> > dp;
void dfs(long long v, long long par = -1) {
  if (par != -1 && g[v].size() == 1) {
    for (long long i = 1; i < dp.size(); ++i) {
      dp[i][v] = i;
      dp[i][par] *= i;
      dp[i][par] %= MOD;
    }
    return;
  }
  for (long long j = 1; j < dp.size(); ++j) {
    dp[j][v] = 1;
  }
  for (auto w : g[v]) {
    if (w == par) continue;
    dfs(w, v);
  }
  for (long long k = 1; k < dp.size(); ++k) {
    dp[k][v] += dp[k - 1][v];
    dp[k][v] %= MOD;
  }
  if (par != -1) {
    for (long long i = 1; i < dp.size(); ++i) {
      dp[i][par] *= dp[i][v];
      dp[i][par] %= MOD;
    }
  }
}
void calc() {
  dp.assign(n + 2, vector<long long>(n, 0));
  dfs(0);
  for (long long i = 1; i <= n + 1; ++i) {
    p.push_back({i, dp[i][0]});
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long d;
  cin >> n >> d;
  g.resize(n);
  for (long long j = 1; j < n; ++j) {
    long long x;
    cin >> x;
    --x;
    g[j].push_back(x);
    g[x].push_back(j);
  }
  calc();
  cout << L(d);
}
