#include <bits/stdc++.h>
using namespace std;
const long long N = 2e3 + 6;
const long long M = 1e9 + 7;
long long arr[N], dp[N][N];
long long n, h;
long long ways(long long s, long long val) {
  if (s == n) {
    if (val == 0)
      return 1;
    else
      return 0;
  }
  long long req = arr[s];
  long long ans = 0;
  long long &mafia = dp[s][val];
  if (mafia != -1) return mafia;
  if (val == req) {
    if (val != 0) ans = ways(s + 1, val - 1) * val % M;
    ans += ways(s + 1, val), ans %= M;
  } else if (val == req - 1) {
    ans += ways(s + 1, val + 1), ans %= M;
    ans += ways(s + 1, val) * val % M, ans %= M;
    ans += ways(s + 1, val), ans %= M;
    ans %= M;
  } else
    ans = 0;
  return mafia = ans;
}
void solve() {
  cin >> n >> h;
  for (long long i = 0; i < n; i++) cin >> arr[i], arr[i] = h - arr[i];
  for (long long i = 0; i < n; i++) {
    if (arr[i] < 0) {
      cout << 0 << "\n";
      return;
    }
  }
  memset(dp, -1, sizeof dp);
  cout << ways(0, 0);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) solve();
}
