#include <bits/stdc++.h>
using namespace std;
const int inf = INT_MAX;
const long long int infl = LLONG_MAX;
int main() {
  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long int n, k;
  cin >> n >> k;
  long long int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long int count = n;
  int val = 1;
  sort(arr, arr + n);
  for (int i = 1; i < n; i++) {
    if (arr[i] == arr[i - 1]) {
      val++;
    }
    if (arr[i] > arr[i - 1] && arr[i] <= arr[i - 1] + k) {
      count = count - val;
    }
    if (arr[i] != arr[i - 1]) {
      val = 1;
    }
  }
  cout << count << endl;
  return 0;
}
