#include <bits/stdc++.h>
using namespace std;
int getSequence(const vector<int> &A, const int K, const int N,
                vector<int> &B) {
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      int diff = A[j] - A[i];
      if (abs(diff) <= K) {
        B.push_back(A[i]);
        B.push_back(A[j]);
        return j;
      }
    }
  }
  return N;
}
size_t getResult(const vector<int> &A, const int K, const int N) {
  if (N == 1) return 1;
  vector<int> B;
  int startA = getSequence(A, K, N, B);
  if (startA >= N) return 1;
  for (int i = startA + 1; i < N; i++) {
    int diff = A[i] - B.back();
    if (abs(diff) <= K) B.push_back(A[i]);
  }
  return B.size();
}
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for (uint i = 0; i < N; i++) {
    cin >> A[i];
  }
  size_t result = getResult(A, K, N);
  cout << result;
}
