#include <bits/stdc++.h>
using namespace std;
int counter[200020];
int times[200020];
int tot = 0;
inline void fr(int &to) {
  char t = getchar();
  to ^= to;
  while (t > 47) {
    to = (to << 3) + (to << 1) + t - 48;
    t = getchar();
  }
}
int main() {
  int n, T, diff;
  int best = 0;
  fr(n);
  fr(T);
  for (int i = 0; i < n; i++) fr(times[i]), times[i] = max(times[i], i + 1);
  for (int i = 0; i < n; i++) {
    tot -= counter[i];
    diff = T - times[i];
    if (diff > 0) {
      tot++;
      if (i + diff < n) counter[i + diff]++;
    }
    best = max(best, tot);
  }
  printf("%d\n", best);
}
