#include <bits/stdc++.h>
using namespace std;
int n, h, a;
long long dp[4000][4000];
int main() {
  dp[0][0] = 1;
  cin >> n >> h;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    if (h - a < 0) {
      cout << 0;
      return 0;
    }
    dp[i][h - a] = dp[i - 1][h - a];
    if (h - a > 0) {
      dp[i][h - a] += dp[i - 1][h - a - 1];
      dp[i][h - a] %= 1000000007;
      dp[i][h - a - 1] = dp[i][h - a] * (h - a);
    }
  }
  cout << dp[n][0];
}
