#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4 + 5;
const int mod = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  int a[n + 5];
  fill(a, a + n + 4, 1e9);
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int j = 0, ans = 0;
  for (int i = 0; i < n; i++) {
    while (j < n && a[j] == a[i]) j++;
    if (a[j] > a[i] + k) ans++;
  }
  cout << ans << endl;
  return 0;
}
