#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k = 0, l, m, n, t, d, A[1000], B[102][102];
  cin >> n >> d;
  for (i = 1; i <= n; i++) {
    cin >> A[i];
  }
  sort(A + 1, A + n + 1);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      B[i][j] = 0;
    }
  }
  for (i = 1; i <= n; i++) {
    for (j = i + 1; j <= n; j++) {
      B[i][j] = A[j] - A[i];
    }
  }
  k = 0;
  for (i = 2; i <= n; i++) {
    if (B[1][i] > d) {
      k++;
    }
  }
  cout << k << endl;
}
