#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
  map<long long, int> mp;
  set<long long> st;
  long long n, t;
  cin >> n >> t;
  for (int i = 0; i < n; ++i) {
    long long c;
    cin >> c;
    long long l = max(0ll, c - i - 1);
    long long r = min(t - i - 1, t);
    if (l >= r) continue;
    st.insert(l);
    st.insert(r);
    mp[l] += 1;
    mp[r] -= 1;
  }
  int cur = 0;
  int maxi = 0;
  for (auto i : st) {
    cur += mp[i];
    maxi = max(maxi, cur);
  }
  cout << maxi << endl;
  return 0;
}
