#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
vector<int> a;
int b[N];
int main() {
  int n, ans, k, x;
  cin >> n >> k;
  ans = n;
  for (int i = 1; i <= n; ++i) {
    cin >> x;
    a.push_back(x);
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < a.size(); i++) {
    int pos1 = upper_bound(a.begin(), a.end(), a[i]) - a.begin();
    int pos2 = upper_bound(a.begin(), a.end(), a[i] + k) - a.begin() - 1;
    if (pos2 < pos1) continue;
    if (pos2 != i && pos1 != i) b[i] = 1;
  }
  for (int i = 0; i < a.size(); i++) {
    if (b[i]) {
      ans--;
    }
  }
  cout << ans;
}
