#include <bits/stdc++.h>
using namespace std;
long long a[300000];
long long n, k;
long long dp[300000];
long long solve(long long spos, long long prev) {
  if (spos == n) return 0;
  if (abs(prev - a[spos]) <= k)
    return max(1 + solve(spos + 1, a[spos]), solve(spos + 1, prev));
  return solve(spos + 1, prev);
}
int32_t main() {
  long long tt = 1;
  while (tt--) {
    cin >> n >> k;
    for (long long i = 0; i < n; i++) cin >> a[i];
    cout << 1 + solve(1, a[0]);
  }
}
