#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
const long long MAXN = 1e6 + 7;
const long double pi = acos(-1);
inline long long read() {
  long long x = 0, ff = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') ff = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * ff;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long pow1(long long p, long long d, long long P) {
  return d ? (pow1(p * p % P, d >> 1, P) * (d & 1 ? p % P : 1)) % P : 1;
}
vector<long long> prime;
bool is_composite[MAXN];
void sieve(long long n) {
  std::fill(is_composite, is_composite + n, false);
  for (long long i = 2; i < n; ++i) {
    if (!is_composite[i]) prime.push_back(i);
    for (long long j = 0; j < prime.size() && i * prime[j] < n; ++j) {
      is_composite[i * prime[j]] = true;
      if (i % prime[j] == 0) break;
    }
  }
}
long long modInverse(long long a, long long m) {
  long long m0 = m, y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long q = a / m, t = m;
    m = a % m;
    a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
long long opt(long long p, long long k, vector<long long>& a,
              vector<long long>& OPT) {
  if (OPT[p] == -1) {
    long long ind = p + 1;
    for (; abs(a[p] - a[ind]) > k && ind < a.size(); ind++)
      ;
    if (ind == a.size())
      OPT[p] = 1;
    else
      OPT[p] = max(opt(ind, k, a, OPT) + 1, opt(p + 1, k, a, OPT));
  }
  return OPT[p];
}
void doit() {
  long long n = read();
  long long k = read();
  vector<long long> a(n);
  for (auto& i : a) i = read();
  vector<long long> OPT(n, -1);
  OPT[n - 1] = 1;
  cout << opt(0, k, a, OPT);
}
int main() {
  doit();
  return 0;
}
