#include <bits/stdc++.h>
using namespace std;
template <typename S, typename T>
ostream &operator<<(ostream &out, pair<S, T> const &p) {
  out << p.first << " " << p.second;
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, vector<T> const &v) {
  long long int l = v.size();
  for (long long int i = 0; i < l - 1; i++) out << v[i] << ' ';
  if (l > 0) out << v[l - 1];
  return out;
}
template <typename T>
void trace(const char *name, T &&arg1) {
  cout << name << " : " << arg1 << "\n";
}
template <typename T, typename... Args>
void trace(const char *names, T &&arg1, Args &&...args) {
  const char *comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  trace(comma + 1, args...);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, k;
  cin >> n >> k;
  long long int arr[n];
  for (long long int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  reverse(arr, arr + n);
  vector<pair<long long, long long> > v;
  long long int curr, count = 0;
  for (long long int i = 0; i < n; i++) {
    if (i == 0) {
      curr = arr[i];
      count = 1;
    } else {
      if (arr[i] == curr) {
        count++;
      } else {
        v.push_back(make_pair(curr, count));
        curr = arr[i];
        count = 1;
      }
    }
  }
  v.push_back(make_pair(curr, count));
  long long int si = v.size();
  long long int ans = 0;
  for (long long int i = si - 2; i >= 0; i--) {
    long long int c = v[i].first;
    long long int cn = v[i + 1].first;
    if (c <= cn + k) {
      ans += v[i + 1].second;
    }
  }
  cout << n - ans << "\n";
  return 0;
}
