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;
double const EPS = 1.0E-9;
int const MOD = (int)1e9 + 7;
inline void read(int &x) { scanf("%d", &(x)); }
inline void read(long long &x) { scanf("%lld", &x); }
inline void read(double &x) { scanf("%lf", &x); }
inline long long gcd(long long x, long long y) {
  return y == 0 ? x : gcd(y, x % y);
}
inline long long lcm(long long x, long long y) {
  return x == 0 && y == 0 ? 0 : x / gcd(x, y) * y;
}
inline long long powmod(long long x, long long n, long long m = MOD) {
  long long r = 1;
  while (n) {
    if (n & 1) r = (r * x) % m;
    x = (x * x) % m;
    n /= 2;
  }
  return r;
}
int leap(int y) { return y % 4 == 0 && y % 100 != 0 || y % 400 == 0; }
int const month[2][12] = {{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
                          {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}};
int const MAXN = 1 << 17;
int const MAXV = 26 * 2 + 10 + 1;
int solve() {
  static const int MPS = 1 << 20;
  std::vector<int> mp(MPS);
  int n, d;
  read(n);
  read(d);
  for (int i = 0; i < n; ++i) {
    int a;
    read(a);
    ++mp[a];
  }
  int ans = n;
  for (int i = 0, j = 0; i < MPS; ++i) {
    if (mp[i]) {
      if (j <= i) j = i + 1;
      while (j < MPS && j - i < d && !mp[j]) ++j;
      if (j < MPS && j - i <= d && mp[j]) {
        ans -= mp[i];
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
int main(int argc, char *argv[]) {
  solve();
  return 0;
}
