#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
int n, k;
int fa[maxn];
int a[maxn];
int cnt;
int gf(int x) { return fa[x] == x ? x : fa[x] = gf(fa[x]); }
void merge(int x, int y) {
  int fx = gf(x);
  int fy = gf(y);
  if (fx != fy) {
    fa[fx] = fy;
    --cnt;
  }
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), fa[i] = i;
  sort(a + 1, a + 1 + n);
  cnt = n;
  int i, j;
  for (i = 1; i <= n - 1; i = j) {
    j = i;
    for (; j <= n && a[i] == a[j]; j++)
      ;
    if (a[i] < a[j] && a[j] <= a[i] + k) {
      for (int z = i; z < j; z++) merge(z, j);
    }
  }
  printf("%d", cnt);
}
