#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MAX = 2e5 + 5;
int n, k, d;
vector<int> a;
int eat[MAX];
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> d;
    a.push_back(d);
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < n; i++) {
    int l = upper_bound(a.begin(), a.end(), a[i]) - a.begin();
    int u = upper_bound(a.begin(), a.end(), a[i] + k) - a.begin() - 1;
    if (l <= u) eat[i] = true;
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (!eat[i]) ans++;
  }
  cout << ans;
  return 0;
}
