#include <bits/stdc++.h>
using namespace std;
vector<int> a;
int main() {
  int n, k, x;
  cin >> n >> k;
  for (int i(0); i < (n); i++) {
    cin >> x;
    a.push_back(x);
  }
  sort((a).begin(), (a).end());
  int ct = 0, cct = 0;
  for (int i(0); i < (n - 1); i++) {
    if (a[i] != a[i + 1] && a[i + 1] <= a[i] + k) {
      if (cct > 0) {
        ct += cct + 1;
        cct = 0;
      } else {
        ct++;
      }
    } else if (a[i] == a[i + 1]) {
      cct++;
    } else {
      cct = 0;
    }
  }
  cout << n - ct;
  return 0;
}
