#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d;
  cin >> n >> d;
  int x[110];
  for (int i = (0); i < (n); ++i) {
    cin >> x[i];
  }
  int flag = true;
  set<int> S;
  while (flag) {
    flag = false;
    int max_counter = 0;
    int index = -1;
    for (int i = (0); i < (n); ++i) {
      if (S.count(i)) {
        continue;
      }
      int counter = 0;
      for (int j = (0); j < (n); ++j) {
        if (j == i || S.count(j)) {
          continue;
        }
        if (abs(x[i] - x[j]) > d) {
          counter++;
          flag = true;
        }
      }
      if (counter > max_counter) {
        max_counter = counter;
        index = i;
      }
    }
    if (max_counter) {
      S.insert(index);
    }
  }
  cout << S.size() << endl;
  return 0;
}
