#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll a, b;
  cin >> a >> b;
  vector<ll> vec(a);
  for (ll i = 0; i < a; i++) {
    cin >> vec.at(i);
  }
  ll c = 1;
  ll e = 1;
  vector<ll> veco(0);
  for (ll j = 0; j < a - 1; j++) {
    cout << j << endl;
    ll d = vec.at(j);
    for (ll i = j + 1; i < a; i++) {
      if (abs(vec.at(i) - d) <= b) {
        c += 1;
        d = vec.at(i);
        j = i - 1;
      }
    }
    veco.push_back(c);
    c = 1;
  }
  sort(veco.begin(), veco.end());
  cout << veco.at(veco.size() - 1) << endl;
  return 0;
}
