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