#include <bits/stdc++.h>
using namespace std;
string ans_Yes = "Yes";
string ans_No = "No";
string ans_yes = "yes";
string ans_no = "no";
vector<long long> A;
long long B;
long long C;
long long N;
long long M;
long long K;
long long ltmp;
string stmp;
double dtmp;
long long d[300010] = {};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> N;
  cin >> K;
  for (long long ni = 0; ni < (N); ni++) {
    cin >> ltmp;
    A.push_back(ltmp);
  }
  d[N - 1] = 1;
  for (long long ni = N - 2; ni >= 0; ni--) {
    for (long long nb = ni + 1; nb < N; nb++) {
      if (abs(A[ni] - A[nb]) <= K) {
        d[ni] = d[nb] + 1;
        break;
      }
    }
  }
  cout << d[0] << endl;
}
