#include <bits/stdc++.h>
const int MAXINT = 2147483640;
const long long MAXLL = 9223372036854775800LL;
const long long MAXN = 1123456;
const long long MOD = 1123456769;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  srand(time(0));
  int n, i, t, a, ans = 0, res = 0;
  vector<pair<int, int> > v;
  cin >> n >> t;
  for (i = 1; i <= n; i++) {
    cin >> a;
    if (a < t) {
      v.push_back(make_pair(max(0, a - i), 1));
      v.push_back(make_pair(max(0, t - i), -1));
    }
  }
  sort(v.begin(), v.end());
  for (i = 0; i < v.size(); i++) {
    res += v[i].second;
    ans = max(ans, res);
  }
  cout << ans << endl;
  return 0;
}
