#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:10000000000")
using namespace std;
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
template <typename T>
ostream& operator<<(ostream& o, vector<T> x) {
  for (auto it : x) o << it << ' ';
  return o;
}
template <typename T>
istream& operator>>(istream& i, vector<T>& x) {
  for (auto& it : x) i >> it;
  return i;
}
template <typename T1, typename T2>
void chkmin(T1& a, T2 b) {
  a > b ? a = b : 0;
}
template <typename T1, typename T2>
void chkmax(T1& a, T2 b) {
  a < b ? a = b : 0;
}
const long long INF = 1000000007;
const long long INF2 = 100000000000000007;
const long long mINF = 1e16;
const long long MOD1 = 998244353;
const long long MOD = 1000000007;
const long long SIZE = 500010;
const long long base = 53;
const long double eps = 1e-6;
const long double pi = acosl(-1.0);
long long add(long long a, long long b) { return ((a + b) % MOD + MOD) % MOD; }
long long mult(long long a, long long b) { return (a * b) % MOD; }
long long binpow(long long a, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) res = mult(res, a);
    a = mult(a, a);
    n >>= 1;
  }
  return res;
}
long long binpow1(long long a, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) {
      res *= a;
    }
    a *= a;
    n >>= 1;
  }
  return res;
}
long long inv(long long a) { return binpow(a, MOD - 2); }
long long del(long long a, long long b) { return mult(a, inv(b)); }
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <typename T>
T sqr(T x) {
  return x * x;
}
long long n, k, a, rs;
map<long long, long long> cnt;
vector<long long> kek;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  rs = n;
  for (long long i = 0; i < n; ++i) {
    cin >> a;
    if (cnt.find(a) == cnt.end()) kek.push_back(a);
    cnt[a]++;
  }
  sort(kek.begin(), kek.end());
  for (long long i = 1; i < kek.size(); ++i) {
    if (kek[i] <= kek[i - 1] + k) {
      rs -= cnt[kek[i - 1]];
    }
  }
  cout << rs;
  return 0;
}
