#include <bits/stdc++.h>
using namespace std;
void f(vector<int> &A, int k) {
  sort(A.begin(), A.end());
  for (int i = 0; i < (int)A.size(); i++) {
    vector<int>::iterator it =
        lower_bound(A.begin() + i + 1, A.end(), A[i] + 1);
    if (it != A.end() && *it <= A[i] + k) {
      A[i] = -1;
    }
  }
  int ans = 0;
  for (int i = 0; i < (int)A.size(); i++) {
    if (A[i] != -1) {
      ans++;
    }
  }
  cout << ans << endl;
}
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> A(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  f(A, k);
  return 0;
}
