#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 2e9 + 5;
int n, d, a[105];
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> d;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  int curD = a[n - 1] - a[0];
  int i = 0;
  int j = n - 1;
  int rm = 0;
  while (i < j && curD > d) {
    if (a[i + 1] - a[i] > a[j] - a[j - 1]) {
      ++i;
    } else {
      --j;
    }
    ++rm;
    curD = a[j] - a[i];
  }
  cout << rm;
}
