#include <bits/stdc++.h>
using namespace std;
int n, d;
vector<int> v[3007];
long long dp[3007][3007];
long long inv[3007];
long long fastpow(long long a, long long x) {
  long long ret = 1;
  while (x != 0) {
    if ((x % 2) == 0) {
      a = (a * a) % 1000000007;
      x /= 2;
    } else {
      ret = (ret * a) % 1000000007;
      x--;
    }
  }
  return ret;
}
void dfs(int vertex) {
  int i, j;
  int sz = v[vertex].size();
  for (i = 1; i <= n + 1; i++) {
    dp[vertex][i] = 1;
  }
  for (i = 0; i < sz; i++) {
    dfs(v[vertex][i]);
    long long aux = 0;
    for (j = 1; j <= n + 1; j++) {
      aux = (aux + dp[v[vertex][i]][j]) % 1000000007;
      dp[vertex][j] = (dp[vertex][j] * aux) % 1000000007;
    }
  }
}
void input() {
  scanf("%d%d", &n, &d);
  int i;
  for (i = 2; i <= n; i++) {
    int x;
    scanf("%d", &x);
    v[x].push_back(i);
  }
  for (i = 0; i <= (n + 1); i++) {
    inv[i] = fastpow(i, 1000000007 - 2);
  }
}
void solve() {
  dfs(1);
  int i, j;
  for (i = 1; i <= (n + 1); i++) {
    dp[1][i] += dp[1][i - 1];
    dp[1][i] %= 1000000007;
  }
  long long ans = 0;
  for (i = 1; i <= n + 1; i++) {
    long long aux = dp[1][i];
    for (j = 1; j <= n + 1; j++) {
      if (i == j) {
        continue;
      }
      int ff = (i - j);
      int coef = 1;
      if (ff < 0) {
        ff = -ff;
        coef = -1;
      }
      aux = (aux * (d - j)) % 1000000007;
      aux = (aux * (inv[ff] * coef)) % 1000000007;
    }
    ans = (ans + aux + 1000000007) % 1000000007;
  }
  printf("%I64d\n", ans);
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  input();
  solve();
  return 0;
}
