#include <bits/stdc++.h>
using namespace std;
int a[1000009], vis[1000009];
int main() {
  int n, k, num, sz;
  cin >> n >> k;
  sz = n;
  for (int i = 0; i < n; i++) {
    cin >> num;
    if (vis[num]++ == 0)
      a[i] = num;
    else
      sz--;
  }
  sort(a, a + n, greater<int>());
  for (int i = sz - 1; i > 0; i--) {
    if (a[i] < a[i - 1] && a[i] + k >= a[i - 1]) n -= vis[a[i]];
  }
  cout << n;
  return 0;
}
