#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 1;
int T[N];
int occ[N];
bool done[N];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &T[i]);
    occ[T[i]]++;
  }
  sort(T, T + n);
  stack<int> stk;
  int ans = n;
  for (int i = 0; i < n; i++) {
    if (done[T[i]]) continue;
    while (!stk.empty() && (T[i] - stk.top()) <= k)
      ans -= occ[stk.top()], stk.pop();
    stk.push(T[i]);
    done[T[i]] = 1;
  }
  printf("%d", ans);
  return 0;
}
