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).
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author kessido
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        FCowmpanyCowmpensation solver = new FCowmpanyCowmpensation();
        solver.solve(1, in, out);
        out.close();
    }

    static class FCowmpanyCowmpensation {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long MOD = MathExtentions.DEFAULT_MOD;
            int n = in.NextInt();
            ArrayList<ArrayList<Integer>> children = new ArrayList<>(n);
            for (int i = 0; i < n; i++) {
                children.add(new ArrayList<>(1));
            }
            int D = in.NextInt();
            for (int i = 1; i < n; i++) {
                children.get(in.NextInt() - 1).add(i);
            }
            long[][] nChooseK = MathExtentions.preComputeNChooseK_MOD_Mod(n, MOD);
            long[][] dp = new long[n][n + 1];
            for (int i = n - 1; i >= 0; i--) {
                if (children.get(i).size() == 0) {
                    for (int j = 1; j <= n; j++) {
                        dp[i][j] = j;
                    }
                } else {
                    for (int j = 1; j <= n; j++) {
                        dp[i][j] = 1;
                    }
                    for (int k : children.get(i)) {
                        for (int j = 1; j <= n; j++) {
                            dp[i][j] *= dp[k][j];
                            dp[i][j] %= MOD;
                        }
                    }
                    for (int j = 2; j <= n; j++) {
                        dp[i][j] += dp[i][j - 1];
                        dp[i][j] %= MOD;
                    }
                }
            }
            long[] dp1 = new long[n + 1];
            for (int i = 1; i <= n; i++) {
                dp1[i] = dp[0][i];
                for (int j = 1; j < i; j++) {
                    dp1[i] -= dp1[j] * nChooseK[i][j];
                    dp1[i] %= MOD;
                    if (dp1[i] < 0) dp1[i] += MOD;
                }
            }
            long res = 0;
            long dChooseI = 1;
            for (int i = 1; i <= n; i++) {
                if (i > D) dChooseI = 0;
                dChooseI *= D + 1 - i;
                dChooseI %= MOD;
                dChooseI *= MathExtentions.modInverse_For_M_Prime(i, MOD);
                dChooseI %= MOD;
                res += (dp1[i] * dChooseI) % MOD;
                res %= MOD;
            }
            if (res < 0) res += MOD;
            out.println(res);
        }

    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine(), " \t\n\r\f,");
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int NextInt() {
            return Integer.parseInt(next());
        }

    }

    static class MathExtentions {
        public static final long DEFAULT_MOD = 1_000_000_007;

        public static long modInverse_For_M_Prime(final long a, final long m) {
            return powerMod(a, m - 2, m);
        }

        public static long powerMod(final long x, final long y, final long m) {
            if (y == 0)
                return 1;

            long p = powerMod(x, y / 2, m) % m;
            p = (p * p) % m;

            if (y % 2 == 0)
                return p;
            else
                return (x * p) % m;
        }

        public static long[][] preComputeNChooseK_MOD_Mod(final int maxn, final long MOD) {
            long[][] res = new long[maxn + 1][];
            for (int i = 0; i <= maxn; i++) {
                res[i] = new long[i + 1];
                res[i][0] = 1;
                res[i][i] = 1;
            }
            for (int i = 2; i <= maxn; i++) {
                for (int j = 1; j <= i >> 1; j++) {
                    long ress = (res[i - 1][j] + res[i - 1][j - 1]);
                    if (ress >= MOD) ress -= MOD;
                    res[i][j] = ress;
                    res[i][i - j] = ress;
                }
            }
            return res;
        }

    }
}

