#include <bits/stdc++.h>
using namespace std;
int a[101];
int main() {
  int n, d, c(0), s(0);
  cin >> n >> d;
  for (int i = 0; i < n; i++) cin >> a[i];
  if (n == 1) {
    cout << "0\n";
    return 0;
  }
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      if (a[j] - a[i] > d) {
        c++;
        break;
      }
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    for (int j = i - 1; j >= 0; j--) {
      if (a[i] - a[j] > d) {
        s++;
        break;
      }
    }
  }
  cout << min(c, s) << endl;
  return 0;
}
