#include <bits/stdc++.h>
using namespace std;
int n, m, D, fa[3005], inv[3005], suf[3005], f[3005][3005];
vector<int> g[3005];
inline int Mod(int x) { return x >= 1000000007 ? x - 1000000007 : x; }
inline void dfs(int x) {
  int i;
  for (i = 1; i <= m; ++i) f[x][i] = 1;
  for (int y : g[x]) {
    dfs(y);
    for (i = 1; i <= m; ++i) f[x][i] = 1ll * f[x][i] * f[y][i] % 1000000007;
  }
  for (i = 1; i <= m; ++i) f[x][i] = Mod(f[x][i - 1] + f[x][i]);
}
inline int Lag(int n) {
  int i, pre, ans = 0;
  for (suf[m + 1] = *inv = inv[1] = 1, i = 2; i <= m; ++i)
    inv[i] =
        1ll * (1000000007 - 1000000007 / i) * inv[1000000007 % i] % 1000000007;
  for (i = 1; i <= m; ++i) inv[i] = 1ll * inv[i - 1] * inv[i] % 1000000007;
  for (i = m; ~i; --i) suf[i] = 1ll * suf[i + 1] * (n - i) % 1000000007;
  for (pre = i = 1; i <= m; pre = 1ll * pre * (n - i) % 1000000007, ++i)
    ans = (ans +
           (((m - i) & 1) ? 1000000007 - 1ll : 1ll) * pre % 1000000007 *
               suf[i + 1] % 1000000007 * inv[i - 1] % 1000000007 * inv[m - i] %
               1000000007 * f[1][i] % 1000000007 +
           1000000007) %
          1000000007;
  return ans;
}
signed main(void) {
  int i, x;
  scanf("%d%d", &n, &D);
  for (i = 2; i <= n; ++i) scanf("%d", &x), g[x].push_back(i);
  m = n + 1, dfs(1), printf("%d\n", D <= n ? f[1][D] : Lag(D));
  return 0;
}
