#include <bits/stdc++.h>
using namespace std;
int n, K;
vector<int> vect;
int res;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> K;
  res = n;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    vect.push_back(a);
  }
  sort(vect.begin(), vect.end());
  int L = 0;
  int R = 0;
  for (int i = 0; i < n; i++) {
    L = max(L, i);
    while (L < n && vect[L] == vect[i]) L++;
    while (R < n && vect[R] <= vect[i] + K) R++;
    if (R > L) res--;
  }
  cout << res;
  return 0;
}
