#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool readInteger(T& x) {
  char c, r = 0, n = 0;
  x = 0;
  while (true) {
    c = getchar();
    if (c < 0 && !r)
      return 0;
    else if (c == '-' && !r)
      n = 1;
    else if (c >= '0' && c <= '9')
      x = x * 10 + c - '0', r = 1;
    else if (r)
      break;
  }
  if (n) x = -x;
  return 1;
}
template <typename T>
vector<T> readIntegral(int n) {
  vector<T> ret(n);
  for (int i = 0; i < n; i++) readInteger(ret[i]);
  return ret;
}
auto readInts = readIntegral<int>;
auto readLongs = readIntegral<long long>;
template <typename T>
vector<vector<T>> make2d(size_t r, size_t c) {
  return vector<vector<T>>(r, vector<T>(c));
}
template <typename T>
vector<vector<T>> make2d(size_t r, size_t c, const T& def) {
  return vector<vector<T>>(r, vector<T>(c, def));
}
template <typename T, T MOD>
struct ModInt {
  T value;
  ModInt() : value(0) {}
  ModInt(T x) {
    x %= MOD;
    if (x < 0) x += MOD;
    value = x;
  }

 public:
  ModInt& operator+=(ModInt x) {
    value += x.value;
    if (value >= MOD) value -= MOD;
    return *this;
  }
  ModInt& operator-=(ModInt x) {
    value -= x.value;
    if (value < 0) value += MOD;
    return *this;
  }
  ModInt& operator*=(ModInt x) {
    value *= x.value;
    value %= MOD;
    return *this;
  }
  ModInt& operator/=(ModInt x) {
    x.invert();
    return *this *= x;
  }
  ModInt operator+(ModInt x) const {
    ModInt o = *this;
    o += x;
    return o;
  }
  ModInt operator-(ModInt x) const {
    ModInt o = *this;
    o -= x;
    return o;
  }
  ModInt operator*(ModInt x) const {
    ModInt o = *this;
    o *= x;
    return o;
  }
  ModInt operator/(ModInt x) const {
    ModInt o = *this;
    o /= x;
    return o;
  }
  bool operator==(ModInt x) const { return value == x.value; }
  bool operator!=(ModInt x) const { return !(*this == x); }
  ModInt operator-() const { return ModInt(0) - *this; }
  ModInt operator^(long long x) const {
    ModInt ret = 1 % MOD;
    ModInt mul = *this;
    while (x) {
      if (x & 1) ret *= mul;
      mul *= mul;
      x >>= 1;
    }
    return ret;
  }
  ModInt& operator^=(long long x) { return *this = *this ^ x; }

 private:
  void invert() { *this ^= MOD - 2; }

 public:
  friend ostream& operator<<(ostream& out, const ModInt& x) {
    return out << x.value;
  }
};
template <typename T>
using v2d = vector<vector<T>>;
long long n, D;
vector<int> children[4000];
long long MOD = 1000000007;
vector<long long> f(int x) {
  vector<vector<long long>> cfs;
  for (int o : children[x]) {
    cfs.push_back(f(o));
  }
  vector<long long> result(n + 1);
  for (int i = (0); i < int(result.size()); ++i) {
    long long prod = 1;
    for (auto& x : cfs) {
      prod *= x[i];
      prod %= MOD;
    }
    result[i] = prod;
    if (i > 0) {
      result[i] += result[i - 1];
      result[i] %= MOD;
    }
  }
  return result;
}
vector<long long> master;
long long divdif[4000][4000];
ModInt<long long, 1000000007> mod_inverse_of[4000];
ModInt<long long, 1000000007> dd(int a, int b) {
  long long& ans = divdif[a][b];
  if (ans != -1) {
    return ans;
  }
  if (a == b) {
    ans = master[a];
  } else {
    ModInt<long long, 1000000007> num = dd(a + 1, b) - dd(a, b - 1);
    long long den = b - a;
    ans = (num * mod_inverse_of[den]).value;
  }
  return ans;
}
int main() {
  for (int i = (0); i < int(4000); ++i) {
    mod_inverse_of[i] =
        ModInt<long long, 1000000007>(1) / ModInt<long long, 1000000007>(i);
  }
  for (int i = (0); i < int(4000); ++i)
    for (int j = (0); j < int(4000); ++j) {
      divdif[i][j] = -1;
    }
  readInteger(n);
  readInteger(D);
  --D;
  for (int i = (0); i < int(n - 1); ++i) {
    int super;
    readInteger(super);
    children[super - 1].push_back(i + 1);
  }
  master = f(0);
  ModInt<long long, 1000000007> xmprod = 1;
  ModInt<long long, 1000000007> ans = 0;
  for (int i = (0); i < int(master.size()); ++i) {
    ans += dd(0, i) * xmprod;
    xmprod *= D - i;
  }
  cout << ans.value << endl;
}
