#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d, a[99], counter = 0;
  vector<int> numVector;
  cin >> n >> d;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    numVector.push_back(a[i]);
  }
  if (numVector.size() == 1) {
    cout << counter;
  };
  sort(numVector.begin(), numVector.end());
  for (int j = 0; j < n; j++) {
    if (!(numVector[n - 1 - j] - numVector[j] <= d)) {
      counter++;
      if (numVector[n - 2 - j] - numVector[j] <= d) {
        break;
      };
      if (numVector[n - 1 - j] - numVector[j + 1] <= d) {
        break;
      }
      counter++;
    } else {
      break;
    }
  }
  cout << counter << endl;
}
