#include <bits/stdc++.h>
using namespace std;
const long long N = 3001;
long long n, D, dp[3001][3001];
vector<long long> c[N];
long long fpow(long long a, long long p) {
  if (!p) return 1;
  long long tmp = fpow(a, p / 2);
  tmp = tmp * tmp;
  tmp %= 1000000007;
  if (p & 1) tmp *= a;
  tmp %= 1000000007;
  return tmp;
}
long long inv(long long a, long long mod) { return fpow(a, 1000000007 - 2); }
long long lagrange(long long val) {
  long long ans = 0;
  for (long long i = 1; i < n + 1; i++) {
    long long u = dp[0][i], d = 1;
    for (long long j = 0; j < n + 1; j++)
      if (i != j) {
        u *= (val - j);
        u %= 1000000007;
        d *= (i - j);
        d %= 1000000007;
      }
    ans += u * inv(d, 1000000007);
    ans %= 1000000007;
  }
  return ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> D;
  for (long long i = 1; i < n; i++) {
    long long p;
    cin >> p;
    p--;
    c[p].push_back(i);
  }
  memset(dp, 0, sizeof(dp));
  for (long long j = 1; j < n + 1; j++)
    for (long long i = n - 1; i >= 0; i--) {
      long long val = 1;
      for (long long k = 0; k < c[i].size(); k++) {
        val *= dp[c[i][k]][j];
        val %= 1000000007;
      }
      dp[i][j] = dp[i][j - 1] + val;
      dp[i][j] %= 1000000007;
    }
  cout << lagrange(D);
  return 0;
}
