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.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class A {

	static final int mod = (int)1e9 + 7;
	static int n, h, a[];
	static int[][] memo;
	
	static int dp(int idx, int open)
	{
		if(idx == n)
			return open == 0 ? 1 : 0;
		if(memo[idx][open] != -1)
			return memo[idx][open];
		int diff = h - a[idx] - open;
		if(diff != 0 && diff != 1)
			return memo[idx][open] = 0;
		int ret = 0, nextOpen = open;
		if(diff == 1)
			++nextOpen;
		ret = dp(idx + 1, nextOpen);
		if(nextOpen > 0)
		{
			ret += 1l * nextOpen * dp(idx + 1, nextOpen - 1) % mod;
			ret %= mod;
		}
		return memo[idx][open] = ret;
	}
	
	public static void main(String[] args) throws IOException 
	{
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		n = sc.nextInt();
		h = sc.nextInt();
		a = new int[n];
		for(int i = 0; i < n; ++i)
			a[i] = sc.nextInt();
		memo = new int[n][n + 1];
		for(int[] x: memo)
			Arrays.fill(x, -1);
		out.println(dp(0, 0));
		out.flush();
		out.close();
	}

	static class Scanner 
	{
		StringTokenizer st;	
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

		public Scanner(FileReader r){	br = new BufferedReader(r);}

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

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

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

		public String nextLine() throws IOException {return br.readLine();}

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

		public boolean ready() throws IOException {return br.ready();}


	}
}