#include <bits/stdc++.h>
using namespace std;
long long cache[300005];
long long k;
long long n;
long long count(long long a[], long long idx, long long previdx) {
  if (idx == n) {
    return 0;
  }
  long long &ans = cache[idx];
  if (ans != -1) {
    return ans;
  }
  long long best = 0;
  if (previdx != -1 && abs(a[idx] - a[previdx]) <= k) {
    best = 1 + count(a, idx + 1, idx);
  } else {
    best = max(count(a, idx + 1, previdx), count(a, idx + 1, idx));
  }
  return ans = best;
}
void solve() {
  cin >> n;
  cin >> k;
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    cache[i] = -1;
  }
  cout << count(a, 0, -1) + 1 << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int tt;
  tt = 1;
  int i = 1;
  while (tt--) {
    solve();
    i++;
  }
  return 0;
}
