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

public class Main {

	public static void main(String[] args) throws IOException {

		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader scn = new InputReader(inputStream);
		PrintWriter prn = new PrintWriter(outputStream);
		II__ASC__II Mechanism = new II__ASC__II();
		Mechanism.Process(scn, prn);
		prn.close();
	}
}

class II__ASC__II {

	final static long MODULO = (int) 1e9 + 7;
	
	public void Process(InputReader scn, PrintWriter prn) throws IOException {
		try {
			int n = scn.nextInt(), h = scn.nextInt(), a[] = new int[n + 2];
			for (int i = 1; i <= n; ++i)
				a[i] = h - scn.nextInt();
			long ways = 1;
			for (int i = 1; i <= n + 1; ++i) {
				if (Math.abs(a[i] - a[i - 1]) > 1) {
					ways = 0;
					break;
				}
				if (a[i] == a[i - 1])
					ways = ways * (a[i - 1] + 1) % MODULO;
				else if (a[i] == a[i - 1] - 1)
					ways = ways * a[i - 1] % MODULO;
			}
			prn.println(ways);
		} catch (Exception e) {
			prn.println(e.getStackTrace());
		}
	}
}

class InputReader {

	public BufferedReader reader;
	public StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

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

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

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

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

	public Integer toInt(String s) {
		return Integer.parseInt(s.trim());
	}

	public Long toLong(String s) {
		return Long.parseLong(s.trim());
	}

	public Double toDouble(String s) {
		return Double.parseDouble(s.trim());
	}

	public int[] getIntArray(String line) {
		String s[] = line.split(" ");
		int a[] = new int[s.length];
		for (int i = 0; i < s.length; ++i) {
			a[i] = Integer.parseInt(s[i]);
		}
		return a;
	}

	public Integer[] getIntegerArray(String line) {
		String s[] = line.split(" ");
		Integer a[] = new Integer[s.length];
		for (int i = 0; i < s.length; ++i) {
			a[i] = Integer.parseInt(s[i]);
		}
		return a;
	}

	public Double[] getDoubleArray(String line) {
		String s[] = line.split(" ");
		Double a[] = new Double[s.length];
		for (int i = 0; i < s.length; ++i) {
			a[i] = Double.parseDouble(s[i]);
		}
		return a;
	}

	public Long[] getLongArray(String line) {
		String s[] = line.split(" ");
		Long a[] = new Long[s.length];
		for (int i = 0; i < s.length; ++i) {
			a[i] = Long.parseLong(s[i]);
		}
		return a;
	}

	public Long getMaxFromLongArray(Long a[]) {
		Long max = Long.MIN_VALUE;
		for (int i = 0; i < a.length; ++i) {
			if (max < a[i]) {
				max = a[i];
			}
		}
		return max;
	}

	public Long getMinFromLongArray(Long a[]) {
		Long min = Long.MAX_VALUE;
		for (int i = 0; i < a.length; ++i) {
			if (min > a[i]) {
				min = a[i];
			}
		}
		return min;
	}

	public Integer getMaxFromIntegerArray(Integer a[]) {
		Integer max = Integer.MIN_VALUE;
		for (int i = 0; i < a.length; ++i) {
			if (max < a[i]) {
				max = a[i];
			}
		}
		return max;
	}

	public Integer getMinFromIntegerArray(Integer a[]) {
		Integer min = Integer.MAX_VALUE;
		for (int i = 0; i < a.length; ++i) {
			if (min > a[i]) {
				min = a[i];
			}
		}
		return min;
	}

	long modPow(long a, long x, long p) {
		long res = 1;
		while (x > 0) {
			if (x % 2 != 0) {
				res = (res % p * a % p) % p;
			}
			a = (a % p * a % p) % p;
			x /= 2;
		}
		return res;
	}

	long modInverse(long a, long p) {
		return modPow(a, p - 2, p);
	}

	long modBinomial(long n, long k, long p) {
		long numerator = 1; // n * (n-1) * ... * (n-k+1)
		for (long i = 0; i < k; i++) {
			numerator = (numerator % p * (n - i) % p) % p;
		}
		long denominator = 1; // k!
		for (long i = 1; i <= k; i++) {
			denominator = (denominator % p * i % p) % p;
		}
		return (numerator % p * modInverse(denominator, p) % p) % p;
	}

	public long calculate(long k, long n) {
		return (modBinomial(n, k, 1000000007));
	}
}