#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second < b.second);
}
bool compare(const pair<string, int> &a, const pair<string, int> &b) {
  return a.second < b.second;
}
double logn(double n, double r) { return (n > r - 1) ? 1 + logn(n / r, r) : 0; }
vector<long long> pwx(10);
void cal(long long x) {
  pwx[0] = 1;
  for (long long i = 1; i < 10; i++) pwx[i] = x * pwx[i - 1];
}
bool check(vector<long long> a, long long x, long long k) {
  for (long long i = 0; i < x; i++) {
    long long cnt = 1, lst = a[i];
    for (long long j = i + 1; j < a.size(); j++) {
      if (abs(a[j] - lst) <= k) {
        cnt++;
        lst = a[j];
      }
    }
    if (cnt >= x) return true;
  }
  return false;
}
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long low = 1, high = n, mid, ans = 1;
  while (low <= high) {
    mid = (low + high) / 2;
    if (check(a, mid, k)) {
      ans = mid;
      low = mid + 1;
    } else {
      high = mid - 1;
    }
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1, k = 1;
  while (t--) {
    solve();
    k++;
  }
}
