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.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.List;
 import java.util.*;
 public class realfast implements Runnable 
  {
    private static final int INF = (int) 1e9;
    long in= 1000000007;
    long fac[]= new long[1000001];
    long inv[]=new long[1000001];
    public  void solve() throws IOException 
    {
        
        int n = readInt();
        int d = readInt();

        fac[0]=1;
        inv[0]=1;

        for(int i=1;i<=4000;i++)
            fac[i]= (i*fac[i-1])%in;

        for(int i =1;i<=4000;i++)
            inv[i]= pow(fac[i],in-2,in);

        ArrayList<Integer> arr[]=new ArrayList[n+1];

        for(int i=1;i<=n;i++)
            arr[i]=new ArrayList<Integer>();


        for(int i=2;i<=n;i++)
        {
            int c = readInt();
            arr[c].add(i);
           // out.println(i+" "+c);
        }

        long dp[][]=new long[n+1][n+1];

        dp(arr,dp,d,1);
         
       //  out.println(dp[1][3]);
         for(int i=2;i<=Math.min(n,d);i++)
         {
            long ans = (dp[1][i]%in);

            for(int j=i-1;j>=1;j--)
                ans = (ans%in-(dp[1][j]*ncr(i,j))%in+in)%in;
            dp[1][i]= ans;
         }

        // out.println(dp[1][3]+" "+dp[1][2]);

         long ans=0;


        
         for(int i=1;i<=Math.min(n,d);i++)
         {
           
            long low =inv[i];
            for(int j=d;j>=d-i+1;j--)
            {
               low = (low*j)%in;        
            }
             ans = (ans%in + (dp[1][i]*low)%in)%in;
         }
        
         out.println(ans);





        


    }
    public long ncr(int n , int r)
    {
        if(r>n||r<0||n<0)
            return 0;

        long pal = fac[n];

        pal = (pal*inv[r])%in;
        pal = (pal*inv[n-r])%in;

        return pal;

    }
    public void dp(ArrayList<Integer> arr[] , long dp[][], int d  , int i )
    {
                int n = arr.length-1;
             //   System.out.println(i);
                if(arr[i].size()==0)
                {
                    for(int j=1;j<=Math.min(n,d);j++)
                    {
                        dp[i][j]=j;                            
                    }
                    return ;
                }

                for(int j=1;j<=Math.min(d,n);j++)
                    dp[i][j]=1;
                
                for(int j =0;j<arr[i].size();j++)
                {
                     int c = arr[i].get(j);
                      dp(arr,dp,d,c);
                     for(int k =1;k<=Math.min(d,n);k++)
                     {
                         dp[i][k]= (dp[i][k]*dp[c][k])%in;
                     }
                }

                for(int j=1;j<=Math.min(d,n);j++)
                {
                    dp[i][j]= (dp[i][j]%in+dp[i][j-1]%in)%in;
                }


    }
   
    public long query(long seg[] , int left, int right , int index, int l , int r)
    {   
         long inf = 100000000;
         inf = inf*inf;
        if(left>=l&&right<=r)
        {
            return seg[index];
        }
        if(l>right||left>r)
            return inf;
        int mid = left+(right-left)/2;
        return Math.min(query(seg,left,mid,2*index+1,l,r),query(seg,mid+1,right,2*index+2,l,r));

    }
    
    public int value (int seg[], int left , int right ,int index, int l, int r)
    {
            
            if(left>right)
            {
              return -100000000;
            }
            if(right<l||left>r)
                return -100000000;
            if(left>=l&&right<=r)
                return seg[index];
            int mid = left+(right-left)/2;
            int val = value(seg,left,mid,2*index+1,l,r);
            int val2 = value(seg,mid+1,right,2*index+2,l,r);
            return Math.max(val,val2);

    }
   
    public int gcd(int a , int b )
    {
      if(a<b)
      {
        int t =a;
        a=b;
        b=t;
      }
      if(a%b==0)
        return b ;
      return gcd(b,a%b);
    }
    public long pow(long n , long p,long m)
    {
         if(p==0)
            return 1;
        long val = pow(n,p/2,m);;
        val= (val*val)%m;
        if(p%2==0)
            return val;
        else
            return (val*n)%m;
    }
    
    
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public static void main(String[] args) {
        new Thread(null, new realfast(), "", 128 * (1L << 20)).start();
    }
 
    private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
    private BufferedReader reader;
    private StringTokenizer tokenizer;
    private PrintWriter out;
 
    @Override
    public void run() {
        try {
            if (ONLINE_JUDGE || !new File("input.txt").exists()) {
                reader = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            } else {
                reader = new BufferedReader(new FileReader("input.txt"));
                out = new PrintWriter("output.txt");
            }
            solve();
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            try {
                reader.close();
            } catch (IOException e) {
                // nothing
            }
            out.close();
        }
    }
 
    private String readString() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
 
    @SuppressWarnings("unused")
    private int readInt() throws IOException {
        return Integer.parseInt(readString());
    }
 
    @SuppressWarnings("unused")
    private long readLong() throws IOException {
        return Long.parseLong(readString());
    }
 
    @SuppressWarnings("unused")
    private double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }
}
class edge implements Comparable<edge>{
    int u ;
    int v;
    
    edge(int  u, int v)
    {
       this.u=u;
       this.v=v;
    }
    public int compareTo(edge e)
    {
        return this.v-e.v;
    }
}