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