#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7, nmax = 2005;
long long dp[nmax][nmax];
int main() {
  int n, h;
  cin >> n >> h;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    a[i] = h - a[i];
    if (a[i] < 0) {
      cout << "0\n";
      return 0;
    }
  }
  dp[0][0] = 1;
  for (int i = 0; i <= n; ++i) {
    dp[i + 1][a[i]] += dp[i][a[i]];
    dp[i + 1][a[i]] %= mod;
    if (a[i] > 0) {
      dp[i + 1][a[i] - 1] += a[i] * dp[i][a[i] - 1];
      dp[i + 1][a[i]] %= mod;
      dp[i + 1][a[i]] += dp[i][a[i] - 1];
      dp[i + 1][a[i]] %= mod;
      dp[i + 1][a[i] - 1] += a[i] * dp[i][a[i]];
      dp[i + 1][a[i] - 1] %= mod;
    }
  }
  cout << dp[n + 1][0] << '\n';
}
