#include <bits/stdc++.h>
using namespace std;
int dp[2010][2010];
int main() {
  int n, h, i;
  scanf("%d%d", &n, &h);
  dp[0][0] = 1;
  for (i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    x = h - x;
    if (x < 0) {
      printf("0\n");
      return 0;
    }
    if (x >= 1) {
      dp[i][x] = (dp[i - 1][x] + dp[i - 1][x - 1]) % 1000000007;
      dp[i][x - 1] = 1LL * dp[i][x] * x % 1000000007;
    } else {
      dp[i][0] = dp[i - 1][0];
    }
  }
  printf("%d\n", dp[n][0]);
  return 0;
}
