#include <bits/stdc++.h>
const bool DEBUG = false;
using namespace std;
const long long maxn = 3e3 + 5;
const long long INF = 1e18 + 1;
const long long M = 1e9 + 7;
const int lg = 21;
long long n, D, ans, f[maxn], rf[maxn], DP[maxn], dp[maxn][maxn];
vector<int> c[maxn];
inline long long POW(long long a, long long b) {
  if (b == 0) return 1;
  long long p = POW(a, b >> 1);
  p = p * p % M;
  if (b & 1) p = p * a % M;
  return p;
}
inline long long C(long long n, long long k) {
  if (k > n) return 0;
  return f[n] * rf[k] % M * rf[n - k] % M;
}
inline long long C_kharaki(long long D, long long k) {
  long long a = 1, b = 1;
  for (int i = 0; i < k; i++) a = a * D % M, D--;
  for (int i = 1; i <= k; i++) b = b * i % M;
  return a * POW(b, M - 2) % M;
}
inline void dfs(int v) {
  for (auto u : c[v]) dfs(u);
  dp[v][1] = 1;
  for (int i = 2; i <= n; i++) {
    long long ans = 1;
    dp[v][i] = dp[v][i - 1];
    for (auto u : c[v]) ans = ans * dp[u][i] % M;
    dp[v][i] = (dp[v][i] + ans) % M;
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> D;
  f[0] = rf[0] = 1;
  for (int i = 1; i < maxn; i++)
    f[i] = f[i - 1] * i % M, rf[i] = rf[i - 1] * POW(i, M - 2) % M;
  for (int i = 1; i <= n - 1; i++) {
    int x;
    cin >> x, x--;
    c[x].push_back(i);
  }
  dfs(0);
  DP[1] = 1;
  for (int i = 2; i <= n; i++) {
    DP[i] = dp[0][i];
    for (int j = 1; j < i; j++) DP[i] = (DP[i] - DP[j] * C(i, j) % M + M) % M;
  }
  for (int i = 1; i <= n; i++) ans = (ans + C_kharaki(D, i) * DP[i]) % M;
  cout << ans << endl;
  return 0;
}
