#include <bits/stdc++.h>
const int Inf = 1e9;
long long LINF = (long long)1e18 + 1e17;
const long long mod = 1e9 + 7;
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n, t;
  cin >> n >> t;
  vector<int> a(n);
  for (int(i) = 0; (i) < n; (i)++) cin >> a[i];
  vector<pair<int, int> > q;
  for (int(i) = 0; (i) < n; (i)++) {
    int l = max(0, a[i] - i - 1);
    int r = max(l, t - i - 1);
    q.push_back(make_pair(l, 1));
    q.push_back(make_pair(r, -1));
  }
  sort((q).begin(), (q).end());
  int ans = 0;
  int cur = 0;
  for (int(i) = 0; (i) < q.size(); (i)++) {
    cur += q[i].second;
    ans = max(ans, cur);
  }
  cout << ans;
  return 0;
}
