#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  for (int i = 0; i < argc; i++) {
    if ((string)argv[i] == "viLap") {
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
    }
  }
  int n, K;
  cin >> n >> K;
  vector<int> mas(n);
  for (int i = 0; i < n; i++) {
    cin >> mas[i];
  }
  sort(mas.begin(), mas.end());
  int ans = 0;
  int eat = 0;
  int i = 1;
  int j = 0;
  while (i < n) {
    if (mas[j] < mas[i]) {
      if (mas[i] <= (mas[j] + K)) {
        if ((i - j) == 1) i++;
        j++;
        eat++;
      } else {
        ans++;
        i++;
        j = i - 1;
      }
    } else {
      i++;
    }
  }
  cout << n - eat;
  return 0;
}
