#include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(T a, T b = 0) {
  if (b == 0) return (a < 0) ? -a : a;
  return (a > b) ? (a - b) : (b - a);
}
template <class T>
inline T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
long long xp(long long b, long long n, long long m) {
  long long r = 1;
  while (n > 0) {
    if (n & 1) {
      r = r * b;
      if (r >= m) r %= m;
    }
    n >>= 1;
    b = b * b;
    if (b >= m) b %= m;
  }
  return r % m;
}
long long inv(long long a, long long m) { return xp(a, m - 2, m); }
bool pali(string temp, int i, int j) {
  if (i >= j) return true;
  if (temp[i] == temp[j]) return pali(temp, i + 1, j - 1);
  return false;
}
template <typename F, typename S>
ostream &operator<<(ostream &os, const pair<F, S> &p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  typename vector<T>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++) {
    if (it != v.begin()) os << ",";
    os << *it;
  }
  return os << "}";
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &v) {
  os << "[";
  typename set<T>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++) {
    if (it != v.begin()) os << ",";
    os << *it;
  }
  return os << "]";
}
template <typename F, typename S>
ostream &operator<<(ostream &os, const map<F, S> &v) {
  os << "[";
  typename map<F, S>::const_iterator it;
  for (it = v.begin(); it != v.end(); it++) {
    if (it != v.begin()) os << ",";
    os << it->first << "=" << it->second;
  }
  return os << "]";
}
int fre[102];
int main() {
  vector<int> num;
  int n;
  cin >> n;
  int d;
  cin >> d;
  for (int i = 0; i < n; i++) {
    int temp;
    scanf("%d", &temp);
    ;
    num.push_back(temp);
  }
  bool ase = false;
  int coun = 0;
  while (1) {
    ase = false;
    memset(fre, 0, sizeof(fre));
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) {
        if (num[i] != -1 and num[j] != -1 and abs(num[i], num[j]) > d)
          fre[i]++, fre[j]++, ase = true;
      }
    if (!ase) break;
    int maxi = -1, id = -1;
    for (int i = 0; i < n; i++)
      if (fre[i] > maxi) maxi = fre[i], id = i;
    num[id] = -1;
    coun++;
  }
  cout << coun << endl;
  return 0;
}
