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
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;



//<editor-fold defaultstate="collapsed" desc="Main">
public class Solution {
// https://netbeans.org/kb/73/java/editor-codereference_ru.html#display
    private void run() {
        try {
            Locale.setDefault(Locale.US);
        } catch (Exception e) {
        }
        boolean oj = true;
        try {
            oj = System.getProperty("MYLOCAL") == null;
        } catch (Exception e) {
        }

        if (oj) {
            sc = new FastScanner(new InputStreamReader(System.in));
            out = new PrintWriter(new OutputStreamWriter(System.out));
        } else {
            try {
                sc = new FastScanner(new FileReader("input.txt"));
                out = new PrintWriter(new FileWriter("output.txt"));
            } catch (IOException e) {
                MLE();
            }
        }
        Solver s = new Solver();
        s.sc = sc;
        s.out = out;
        s.solve();
        if (!oj) {
            err.println("Time: " + (System.currentTimeMillis() - timeBegin) / 1e3);
            err.printf("Mem: %d\n", (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) >> 20);
        }
        out.flush();
    }

    private void show(int[] arr) {
        for (int v : arr) {
            err.print(" " + v);
        }
        err.println();
    }

    public static void exit() {
        err.println("Time: " + (System.currentTimeMillis() - timeBegin) / 1e3);
        out.flush();
        out.close();
        System.exit(0);
    }

    public static void MLE() {
        int[][] arr = new int[1024 * 1024][];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = new int[1024 * 1024];
        }
    }

    public static void main(String[] args) {
        new Solution().run();
    }

    static long timeBegin = System.currentTimeMillis();
    static FastScanner sc;
    static PrintWriter out;
    static PrintStream err = System.err;
}
//</editor-fold>

//<editor-fold defaultstate="collapsed" desc="FastScanner">
class FastScanner {

    BufferedReader br;
    StringTokenizer st;

    FastScanner(InputStreamReader reader) {
        br = new BufferedReader(reader);
        st = new StringTokenizer("");
    }

    String next() {
        while (!st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException ex) {
                Solution.MLE();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }
    double nextDouble() {
        return Double.parseDouble(next());
    }
}
//</editor-fold>

class Solver {
    void ass(boolean OK) { if(!OK)Solution.MLE(); }

    FastScanner sc;
    PrintWriter out;
    static PrintStream err = System.err;

    int n, h;
    int[] a;
    final int mod = 1000000007, maxH = 2005;
    long[][] dp;
    
    boolean f( int a, int b, int c ){
        return a <= b && b <= c;
    }
    
    void solve() {
        n = sc.nextInt();
        h = sc.nextInt();
        a = new int[n+1];
        a[0] = h;
        for (int i = 1; i <= n; i++)
            a[i] = sc.nextInt();
        
        dp = new long[n+2][n+1];
        dp[0][0] = 1;
        for (int i = 0; i <= n; i++) {
            int x = h - a[i];
            int y = h - a[i] - 1;
            if( f(0,y,n)               ) dp[i+1][y  ] += dp[i][y];
            if( f(0,x,n) && f(0,x-1,n) ) dp[i+1][x-1] += dp[i][x] * x % mod;
            if( f(0,y,n) && f(0,y+1,n) ) dp[i+1][y+1] += dp[i][y];
            if( f(0,x,n)               ) dp[i+1][x  ] += dp[i][x];
            
            if( f(0,y,n)               ) dp[i+1][y] += dp[i][y] * y % mod;
            //err.println(i +") "+ Arrays.toString(dp[i]));
            for( int c = 0; c < dp[i+1].length; ++c ){
                dp[i+1][c] %= mod;
            }
        }
        err.println( (n+1) +") "+ Arrays.toString(dp[n+1]));
        
        out.println(dp[n+1][0] % mod);
    }



}