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