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