#include <bits/stdc++.h>
using namespace std;
const int MN = 3005, inf = 1000000005, mod = 1000000007;
const long long INF = 1000000000000000005LL;
long long dp[MN][MN];
int used[MN];
vector<int> G[MN];
int n;
void dfs(int x) {
  used[x] = 1;
  for (int j = 0; j <= n; ++j) dp[x][j] = 1LL;
  for (auto v : G[x]) {
    if (!used[v]) {
      dfs(v);
      for (int j = 0; j <= n; ++j) {
        dp[x][j] *= dp[v][j];
        dp[x][j] %= mod;
      }
    }
  }
  for (int j = 1; j <= n; ++j) {
    dp[x][j] += dp[x][j - 1];
    dp[x][j] %= mod;
  }
}
long long pot(long long a, long long b) {
  if (b == 0LL) return 1LL;
  long long ret = pot(a, b >> 1);
  ret = (ret * ret) % mod;
  if (b & 1LL) ret = (ret * a) % mod;
  return ret;
}
long long rev(long long x) { return pot(x, mod - 2); }
long long inter(int d) {
  long long res = 0LL;
  for (int i = 0; i <= n; ++i) {
    long long s = 1LL;
    long long dod = 1LL;
    for (int j = 0; j <= n; ++j)
      if (j != i) {
        s = (s * (long long)(i - j + mod)) % mod;
        dod = (dod * (long long)(d - j)) % mod;
      }
    dod = (dod * rev(s)) % mod;
    dod = (dp[1][i] * dod) % mod;
    res += dod;
    res %= mod;
  }
  return res;
}
int main() {
  int d;
  scanf("%d%d", &n, &d);
  --d;
  for (int i = 2; i <= n; ++i) {
    int a;
    scanf("%d", &a);
    G[a].push_back(i);
    G[i].push_back(a);
  }
  dfs(1);
  if (d <= n)
    printf("%lld", dp[1][d]);
  else
    printf("%lld", inter(d));
  return 0;
}
