#include <bits/stdc++.h>
using namespace std;
template <class BidirIt>
BidirIt prev(BidirIt it,
             typename iterator_traits<BidirIt>::difference_type n = 1) {
  advance(it, -n);
  return it;
}
template <class ForwardIt>
ForwardIt next(ForwardIt it,
               typename iterator_traits<ForwardIt>::difference_type n = 1) {
  advance(it, n);
  return it;
}
const double EPS = 1e-9;
const double PI = 3.141592653589793238462;
template <typename T>
inline T sq(T a) {
  return a * a;
}
const int MAXN = 2005;
const int MOD = 1e9 + 7;
inline void add_mod(int &a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
inline int mul_mod(int a, int b) { return a * 1LL * b % MOD; }
int a[MAXN];
map<int, int> dp[MAXN];
int main() {
  int n, h;
  scanf("%d %d", &n, &h);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    int j = h - a[i];
    if (j < 0) {
      puts("0");
      return 0;
    }
    add_mod(dp[i][j - 1], mul_mod(j, dp[i - 1][j]));
    add_mod(dp[i][j - 1], mul_mod(j - 1, dp[i - 1][j - 1]));
    if (j - 1 >= 0) add_mod(dp[i][j - 1], dp[i - 1][j - 1]);
    if (j - 1 >= 0) add_mod(dp[i][j], dp[i - 1][j - 1]);
    add_mod(dp[i][j], dp[i - 1][j]);
  }
  printf("%d\n", dp[n][0]);
  return 0;
}
