#include <bits/stdc++.h>
const int mod = 1000000007;
const int inf = 1000000009;
const long long INF = 1000000000000000009;
const long long big = 1000000000000000;
const long double eps = 0.0000000001;
using namespace std;
int DP[2005][2005], T[2005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  int n, h;
  cin >> n >> h;
  for (int i = 1; i <= n; i++) cin >> T[i];
  DP[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    int j = h - T[i];
    if (j < 0) continue;
    DP[i][j] = (DP[i][j] + DP[i - 1][j]) % mod;
    DP[i][j] %= mod;
    if (j > 0) {
      DP[i][j] = (DP[i][j] + DP[i - 1][j - 1]) % mod;
      DP[i][j - 1] = ((long long int)DP[i][j - 1] + DP[i - 1][j - 1] +
                      (long long int)DP[i - 1][j] * j) %
                     mod;
      DP[i][j - 1] =
          (DP[i][j - 1] + (long long int)DP[i - 1][j - 1] * (j - 1)) % mod;
    }
  }
  cout << DP[n][0];
  return 0;
}
