Allen, having graduated from the MOO Institute of Techcowlogy (MIT), has started a startup! Allen is the president of his startup. He also hires n-1 other employees, each of which is assigned a direct superior. If u is a superior of v and v is a superior of w then also u is a superior of w. Additionally, there are no u and v such that u is the superior of v and v is the superior of u. Allen himself has no superior. Allen is employee number 1, and the others are employee numbers 2 through n.

Finally, Allen must assign salaries to each employee in the company including himself. Due to budget constraints, each employee's salary is an integer between 1 and D. Additionally, no employee can make strictly more than his superior.

Help Allen find the number of ways to assign salaries. As this number may be large, output it modulo 10^9 + 7.

Input

The first line of the input contains two integers n and D (1 ≤ n ≤ 3000, 1 ≤ D ≤ 10^9).

The remaining n-1 lines each contain a single positive integer, where the i-th line contains the integer p_i (1 ≤ p_i ≤ i). p_i denotes the direct superior of employee i+1.

Output

Output a single integer: the number of ways to assign salaries modulo 10^9 + 7.

Examples

Input

3 2
1
1


Output

5


Input

3 3
1
2


Output

10


Input

2 5
1


Output

15

Note

In the first sample case, employee 2 and 3 report directly to Allen. The three salaries, in order, can be (1,1,1), (2,1,1), (2,1,2), (2,2,1) or (2,2,2).

In the second sample case, employee 2 reports to Allen and employee 3 reports to employee 2. In order, the possible salaries are (1,1,1), (2,1,1), (2,2,1), (2,2,2), (3,1,1), (3,2,1), (3,2,2), (3,3,1), (3,3,2), (3,3,3).
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
using ll = long long;
using vi = vector<int>;
using pi = pair<int, int>;
using vpi = vector<pair<int, int>>;
using pl = pair<ll, ll>;
using vl = vector<ll>;
using vpl = vector<pl>;
using ld = long double;
template <typename T>
using pqg = priority_queue<T, vector<T>, greater<T>>;
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}
template <typename T_container, typename T = typename enable_if<
                                    !is_same<T_container, string>::value,
                                    typename T_container::value_type>::type>
ostream& operator<<(ostream& os, const T_container& v) {
  os << '{';
  string sep;
  for (const T& x : v) os << sep << x, sep = ", ";
  return os << '}';
}
void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << ' ' << H;
  dbg_out(T...);
}
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;
template <int MOD, int RT>
struct mint {
  static const int mod = MOD;
  static constexpr mint rt() { return RT; }
  int v;
  explicit operator int() const { return v; }
  mint() { v = 0; }
  mint(ll _v) {
    v = int((-MOD < _v && _v < MOD) ? _v : _v % MOD);
    if (v < 0) v += MOD;
  }
  friend bool operator==(const mint& a, const mint& b) { return a.v == b.v; }
  friend bool operator!=(const mint& a, const mint& b) { return !(a == b); }
  friend bool operator<(const mint& a, const mint& b) { return a.v < b.v; }
  mint& operator+=(const mint& m) {
    if ((v += m.v) >= MOD) v -= MOD;
    return *this;
  }
  mint& operator-=(const mint& m) {
    if ((v -= m.v) < 0) v += MOD;
    return *this;
  }
  mint& operator*=(const mint& m) {
    v = int((ll)v * m.v % MOD);
    return *this;
  }
  mint& operator/=(const mint& m) { return (*this) *= inv(m); }
  friend mint pow(mint a, ll p) {
    mint ans = 1;
    assert(p >= 0);
    for (; p; p /= 2, a *= a)
      if (p & 1) ans *= a;
    return ans;
  }
  friend mint inv(const mint& a) {
    assert(a.v != 0);
    return pow(a, MOD - 2);
  }
  mint operator-() const { return mint(-v); }
  mint& operator++() { return *this += 1; }
  mint& operator--() { return *this -= 1; }
  friend mint operator+(mint a, const mint& b) { return a += b; }
  friend mint operator-(mint a, const mint& b) { return a -= b; }
  friend mint operator*(mint a, const mint& b) { return a *= b; }
  friend mint operator/(mint a, const mint& b) { return a /= b; }
};
using Mint = mint<MOD, 5>;
ostream& operator<<(ostream& os, Mint x) {
  os << x.v;
  return os;
}
const int N = 1e5 + 10;
Mint fact[N], inv_fact[N], inverse[N];
void precalc() {
  for (int i = 0; i < N; i++) {
    if (i == 0)
      fact[i] = 1LL;
    else
      fact[i] = fact[i - 1] * i;
  }
  inverse[1] = 1;
  for (int i = 2; i < N; ++i) {
    inverse[i] = MOD - (MOD / i) * inverse[MOD % i];
  }
  inv_fact[0] = inv_fact[1] = 1;
  for (ll i = 2; i < N; ++i) {
    inv_fact[i] = inv_fact[i - 1] * inverse[i];
  }
}
Mint nCk(ll n, ll k) {
  if (n < k) return 0LL;
  return fact[n] * inv_fact[k] * inv_fact[n - k];
}
const int MN = 3011;
vi G[MN];
Mint dp[MN][MN];
int n, deg, D;
void dfs(int V, int pV) {
  for (int i = 1; i <= deg + 1; ++i) {
    dp[V][i] = 1;
  }
  for (int e : G[V]) {
    if (e == pV) continue;
    dfs(e, V);
    for (int i = 1; i <= deg + 1; ++i) {
      dp[V][i] *= dp[e][i];
    }
  }
  for (int i = 1; i <= deg + 1; ++i) {
    dp[V][i] += dp[V][i - 1];
    ;
  }
}
void solve() {
  cin >> n >> D;
  deg = n;
  vector<Mint> v(deg + 2);
  for (int i = 2; i <= n; ++i) {
    int t;
    cin >> t;
    G[t].push_back(i);
    G[i].push_back(t);
  }
  dfs(1, 0);
  for (int i = 1; i <= deg + 1; ++i) {
    v[i] = dp[1][i];
  };
  if (D <= deg + 1) {
    cout << v[D] << "\n";
    return;
  }
  vector<Mint> L(deg + 2, 1), R(deg + 2, 1);
  for (int i = 1; i < deg + 1; ++i) {
    L[i + 1] = L[i] * (D - i);
  }
  for (int i = deg + 1; i >= 2; --i) {
    R[i - 1] = R[i] * (D - i);
  }
  Mint ans = 0;
  for (int i = 1; i <= deg + 1; ++i) {
    Mint product = L[i] * R[i] * v[i] * inv_fact[i - 1] * inv_fact[deg + 1 - i];
    if ((deg + 1 - i) & 1)
      ans -= product;
    else
      ans += product;
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  precalc();
  solve();
}
