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
//package codeforces;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class D {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    PrintWriter writer = new PrintWriter(System.out);
    StringTokenizer stringTokenizer;

    String next() throws IOException {
        while (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
            stringTokenizer = new StringTokenizer(reader.readLine());
        }
        return stringTokenizer.nextToken();
    }

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

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

    @SuppressWarnings("unchecked")
    void solve() throws IOException {
        final int n = nextInt();
        int h = nextInt();
        final int[] a = new int[n];
        for(int i = 0; i < n; i++) {
            a[i] = h - nextInt();
        }
        class Utils {
            int MOD = 1000 * 1000 * 1000 + 7;

            int sum(int a, int b) {
                a += b;
                return a >= MOD ? a - MOD : a;
            }
            int product(int a, int b) {
                return (int)(1l * a * b % MOD);
            }

            int count(int position, int segments) {
                if(segments < 0) {
                    return 0;
                }
                if(position == n) {
                    return segments == 0 ? 1 : 0;
                }
                if(segments == a[position]) {
                    return sum(count(position + 1, segments), product(segments, count(position + 1, segments - 1)));
                }
                if(segments == a[position] - 1) {
                    return sum(count(position + 1, segments + 1), product(segments + 1, count(position + 1, segments)));
                }
                return 0;
            }
        }
        class UtilsWithCache extends Utils {
            int[][] cache = new int[n + 1][n + 1];
            boolean[][] visited = new boolean[n + 1][n + 1];

            @Override
            int count(int position, int segments) {
                if(segments < 0) {
                    return 0;
                }
                if(!visited[position][segments]) {
                    visited[position][segments] = true;
                    cache[position][segments] = super.count(position, segments);
                }
                return cache[position][segments];
            }
        }
        Utils utils = new UtilsWithCache();
        writer.println(utils.count(0, 0));
        writer.close();
    }

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