#include <bits/stdc++.h>
using namespace std;
long long arr[10000] = {}, rar[10000] = {}, tmp, v[3] = {};
int main() {
  long long x, y, j = 0, m = 0;
  cin >> x >> y;
  for (int k = 0; k < x; k++) {
    cin >> arr[k];
  }
  for (int k = 0; k < x; k++) {
    for (int l = 0; l < x; l++) {
      if (arr[k] - arr[l] > y) {
        arr[k] = 0;
        m++;
      }
    }
  }
  cout << m;
  return 0;
}
