#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
template <class T>
bool chmax(T& a, const T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T& a, const T b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
ll llceil(ll a, ll b) { return (a + b - 1) / b; }
ll bitlen(ll b) {
  if (b <= 0) {
    return 0;
  }
  return (64LL - __builtin_clzll(b));
}
string toupper(const string& S) {
  string T(S);
  for (ll i = (0); i < (((ll)(T).size())); ++i) T[i] = toupper(T[i]);
  return T;
}
string tolower(const string& S) {
  string T(S);
  for (ll i = (0); i < (((ll)(T).size())); ++i) T[i] = tolower(T[i]);
  return T;
}
using P = pair<ll, ll>;
using VP = vector<P>;
using VVP = vector<VP>;
using VS = vector<string>;
using VVS = vector<VS>;
using VLL = vector<ll>;
using VVLL = vector<VLL>;
using VVVLL = vector<VVLL>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VVVB = vector<VVB>;
using VD = vector<double>;
using VVD = vector<VD>;
using VVVD = vector<VVD>;
using VLD = vector<ld>;
using VVLD = vector<VLD>;
using VVVLD = vector<VVLD>;
static const double EPS = 1e-10;
static const double PI = acos(-1.0);
static const ll MOD = 1000000007;
static const ll INF = (1LL << 62) - 1;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << fixed << setprecision(15);
  ll N, K;
  cin >> N >> K;
  VLL A(N);
  for (ll i = (0); i < (N); ++i) cin >> A[i];
  map<ll, ll> cnt;
  for (ll a : A) cnt[a]++;
  VP X;
  for (auto [a, n] : cnt) X.push_back(P(a, n));
  ll ans = N;
  for (ll i = (0); i < (((ll)(X).size()) - 1); ++i) {
    auto [a1, n1] = X[i];
    auto [a2, _] = X[i + 1];
    if (a1 < a2 && a2 - a1 <= K) ans -= n1;
  }
  cout << (ans) << '\n';
  return 0;
}
