#include <bits/stdc++.h>
using namespace std;
const int NN = 3e3 + 5, Mod = 1e9 + 7;
int Ad(int x, int y) { return ((x + y) >= Mod) ? (x + y - Mod) : (x + y); }
int Ml(int x, int y) { return 1ll * x * y % Mod; }
int Dc(int x, int y) { return ((x - y) < 0) ? (x - y + Mod) : (x - y); }
int ksm(int x, int y) {
  int ret = 1;
  for (; y; y >>= 1, x = Ml(x, x))
    if (y & 1) ret = Ml(ret, x);
  return ret;
}
int N, D, par[NN], dp[NN][NN], sum[NN][NN];
vector<int> son[NN];
void Dfs(int u) {
  for (int i = 1; i <= N + 1; ++i) dp[u][i] = 1;
  for (int i = 0; i < son[u].size(); ++i) {
    int v = son[u][i];
    Dfs(v);
    for (int j = 1; j <= N + 1; ++j) dp[u][j] = Ml(sum[v][j], dp[u][j]);
  }
  for (int i = 1; i <= N + 1; ++i) sum[u][i] = Ad(sum[u][i - 1], dp[u][i]);
}
int Ni1[NN], Ni2[NN];
int main() {
  scanf("%d%d", &N, &D);
  for (int i = 2; i <= N; ++i) {
    scanf("%d", &par[i]);
    son[par[i]].push_back(i);
  }
  Dfs(1);
  for (int i = 1; i <= N; ++i) Ni1[i] = ksm(i, Mod - 2);
  for (int i = 1; i <= N; ++i) Ni2[i] = ksm(Mod - i, Mod - 2);
  int ans = 0;
  for (int i = 1; i <= N + 1; ++i) {
    int ret = sum[1][i];
    for (int j = 1; j <= N + 1; ++j)
      if (j != i) {
        ret = Ml(ret, (D - j));
        if (i - j > 0)
          ret = Ml(ret, Ni1[i - j]);
        else
          ret = Ml(ret, Ni2[j - i]);
      }
    ans = Ad(ans, ret);
  }
  printf("%d\n", (ans % Mod + Mod) % Mod);
  return 0;
}
