Peter has a sequence of integers a1, a2, ..., an. Peter wants all numbers in the sequence to equal h. He can perform the operation of "adding one on the segment [l, r]": add one to all elements of the sequence with indices from l to r (inclusive). At that, Peter never chooses any element as the beginning of the segment twice. Similarly, Peter never chooses any element as the end of the segment twice. In other words, for any two segments [l1, r1] and [l2, r2], where Peter added one, the following inequalities hold: l1 ≠ l2 and r1 ≠ r2.

How many distinct ways are there to make all numbers in the sequence equal h? Print this number of ways modulo 1000000007 (109 + 7). Two ways are considered distinct if one of them has a segment that isn't in the other way.

Input

The first line contains two integers n, h (1 ≤ n, h ≤ 2000). The next line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 2000).

Output

Print a single integer — the answer to the problem modulo 1000000007 (109 + 7).

Examples

Input

3 2
1 1 1


Output

4


Input

5 1
1 1 1 1 1


Output

1


Input

4 3
3 2 1 1


Output

0
// Don't place your source in a package
import javax.swing.*;
import java.lang.reflect.Array;
import java.text.DecimalFormat;
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;
import java.util.stream.Stream;



// Please name your class Main
public class Main {
    static FastScanner fs=new FastScanner();
    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        public String next() {
            while (!st.hasMoreElements())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }
        int Int() {
            return Integer.parseInt(next());
        }

        long Long() {
            return Long.parseLong(next());
        }

        String Str(){
            return next();
        }
    }


    public static void main (String[] args) throws java.lang.Exception {
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        //reading /writing file
        //Scanner sc=new Scanner(new File("input.txt"));
        //PrintWriter pr=new PrintWriter("output.txt");

        int T=1;
        for(int t=0;t<T;t++){
            int n=Int();int h=Int();
            int A[]=Arr(n);
            Solution sol=new Solution(out);
            sol.solution(A,h);
        }
        out.close();

    }

    public static int[] Arr(int n){
        int A[]=new int[n];
        for(int i=0;i<n;i++)A[i]=Int();
        return A;
    }
    public static int Int(){
        return fs.Int();
    }
    public static long Long(){
        return fs.Long();
    }
    public static String Str(){
        return fs.Str();
    }

}








class Solution{
    PrintWriter out;
    int INF=Integer.MAX_VALUE;
    int MOD=1000000007;
    public Solution(PrintWriter out){
        this.out=out;
    }

    long dp[][];
    public void solution(int A[],int h) {
        for(int i=0;i<A.length;i++){
            A[i]=h-A[i];
            if(A[i]<0){
                out.println(0);
                return;
            }
        }

        dp=new long[A.length+1][h+1];
        for(int i=0;i<dp.length;i++){
            Arrays.fill(dp[i],-1);
        }
        long res=dfs(A,0,0);
        out.println(res);

    }

    public long dfs(int A[],int i,int cnt){
        if(cnt<0)return 0;

        if(i>=A.length){
            if(cnt!=0)return 0;
            return 1;
        }


        if(cnt+1<A[i]||cnt>A[i]){
            dp[i][cnt]=0;
            return 0;
        }
        if(dp[i][cnt]!=-1)return dp[i][cnt];


        long res = 0;
        if(cnt+1==A[i]){
            res+=(cnt+1l)*dfs(A,i+1,cnt);
            res%=MOD;
            res+=dfs(A,i+1,cnt+1);
            res%=MOD;
        }
        else{//cnt == A[i]
            res += dfs(A,i+1,cnt);
            res%=MOD;
            res+=(cnt+0l)*dfs(A,i+1,cnt-1);
            res%=MOD;
        }
        dp[i][cnt]=res;
        return res;

    }


}











