2 1
1 1
 4 1
2 2 1 1
 10 1
2 6 3 4 2 4 4 3 2 1
 2 1
999152 999153
 8 1000000
1 1 5 1000000 1000000 2 2 2
 9 2
1 6 1 5 5 8 6 8 7
 15 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 1 4
8
 10 1
6 3 1 3 6 4 1 3 6 4
 10 1
1 2 3 5 6 8 10 11 9 4
 7 2
1 5 5 8 9 8 8
 2 1000000
1 1000000
 8 2
3 13 9 8 3 13 9 14
 1 1
1
 2 1
1 2

2
 2
 4
 1
 2
 4
 15
 1
 7
 2
 4
 1
 5
 1
 1

#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;
}
