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;
const int mod = 1e9 + 7;
vector<int> p;
int ho, mi, se;
void fix_time() {
  if (se > 59) mi += se / 60, se = se % 60;
  if (se < 0) se += 60, mi--;
  if (mi > 59) ho += mi / 60, mi = mi % 60;
  if (mi < 0) mi += 60, ho--;
}
int my_pow(int x, int y) {
  long long num = 1;
  for (int i = x; y > 0; i = (i * i), y >>= 1)
    if (y & 1) num = ((num)*i);
  return num;
}
bool prime[1000001];
void sieve() {
  for (int i = 2; i <= 1000000; i += 2) prime[i] = false, prime[i - 1] = true;
  prime[2] = true;
  for (int i = 3; i <= 1000; i += 2)
    if (prime[i])
      for (int j = i * i; j <= 1000000; j += 2 * i) prime[j] = false;
}
void pfact(int x) {
  if (x % 2 == 0) {
    p.push_back(2);
    while (x % 2 == 0) x /= 2;
  }
  for (int i = 3; i * i <= x; i += 2)
    if (x % i == 0) {
      p.push_back(i);
      while (x % i == 0) x /= i;
    }
  if (x > 1) p.push_back(x);
}
int n, m, k, a[200003], b, cnt;
set<int> bac;
int num[1000004];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    bac.insert(a[i]);
    num[a[i]]++;
  }
  for (auto it = bac.begin(); it != --bac.end();) {
    auto it2 = it;
    ++it2;
    int bac1 = *it, bac2 = *it2;
    if (bac2 > bac1 && bac2 <= bac1 + k) bac.erase(it);
    it = it2;
  }
  for (auto it = bac.begin(); it != bac.end(); it++) cnt += num[*it];
  cout << cnt;
  return 0;
}
