#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, b;
  cin >> n >> b;
  vector<int> vec(n);
  for (int a = 0; a < n; a++) {
    cin >> vec[a];
  }
  sort(vec.begin(), vec.begin() + n);
  bool flag = false;
  int c = 1;
  for (int a = 1; a < n; a++) {
    if ((vec[a] - vec[0]) <= b) {
      c++;
    } else
      break;
  }
  cout << (n - c);
}
