#include <bits/stdc++.h>
using namespace std;
int n, h;
int ar1[2005];
long long int dp[2005][2005];
long long int call(int ind, int st) {
  if (ind == n) return st == 0;
  long long int &ret = dp[ind][st];
  if (ret != -1) return ret;
  ret = 0;
  if (st == ar1[ind]) {
    ret = call(ind + 1, st);
    ret = (ret + ((st * call(ind + 1, st - 1)) % 1000000007)) % 1000000007;
  } else if (st == ar1[ind] - 1)
    ret = call(ind, st + 1);
  return ret;
}
int main() {
  scanf("%d %d", &n, &h);
  for (int i = 0; i < n; i++) scanf("%d", &ar1[i]);
  for (int i = 0; i < n; i++) ar1[i] = h - ar1[i];
  for (int i = 0; i < n; i++)
    if (ar1[i] < 0) {
      cout << 0 << endl;
      return 0;
    }
  memset(dp, -1, sizeof(dp));
  cout << call(0, 0) << endl;
  return 0;
}
