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

public class Main {

    final int MAX_N = 2001;
    final long MODULO = 1000 * 1000 * 1000 + 7;
    
    long a[] = new long[MAX_N]; 
    long d[][] = new long[MAX_N][MAX_N];
    
    int n;
    long h;
    
    long countResult(int i, int opened) {
        if (i >= n || i < 0 || opened < 0) return 0;
        
        if (d[i][opened]!=-1L) {
            return d[i][opened];
        }       
        
        long diff = h - (a[i]+opened);
        
        long res = 0;
        
        if (i == n-1) {
            if ((diff == 0 && opened < 2) || (diff == 1 && opened == 0)) {
                return d[i][opened] = 1;
            } else {
                return d[i][opened] = 0;
            }
        }
        
        if (diff == 0) {
            res = (countResult(i+1, opened) + opened*countResult(i+1, opened-1)) % MODULO;
        } else if (diff == 1) {
            res = (countResult(i+1, opened)*(opened>0 ? (opened+1) : 1) + countResult(i+1, opened+1)) % MODULO;
        } else {
            res = 0;
        }
        
        return d[i][opened] = res;
    }
    
    void solve() throws IOException {
        n = nextInt(); 
        h = nextLong();

        for (int i = 0; i < n; ++i) {
            a[i] = nextLong();
        }

        for (int i = 0; i < n; ++i) {
            fill(d[i], -1L);
        }
        
        long res = countResult(0, 0);
        
        System.out.println(res);
    }

    int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    int lcm(int a, int b) {
        return a / gcd(a, b) * b;
    }

    int modulo(int x, int y) {
        return (x % y + y) % y;
    }

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

    final String fileNameIn = "input.txt";
    final String fileNameOut = "output.txt";
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");

    private void run() throws IOException {

        if (new File(fileNameIn).exists())
            in = new BufferedReader(new FileReader(fileNameIn));
        else
            in = new BufferedReader(new InputStreamReader(System.in));

        out = new PrintWriter(System.out);
        // out = new PrintWriter(new FileWriter(fileNameOut));

        solve();

        in.close();
        out.close();
    }

    String nextToken() throws IOException {
        while (!st.hasMoreTokens())
            st = new StringTokenizer(in.readLine());
        return st.nextToken();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextString() throws IOException {
        st = new StringTokenizer("");
        return in.readLine();
    }

    boolean EOF() throws IOException {
        while (!st.hasMoreTokens()) {
            String s = in.readLine();
            if (s == null)
                return true;
            st = new StringTokenizer(s);
        }
        return false;
    }
}