#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k;
  int s = 0, p = 0, l = 0;
  int n, m, d;
  int c, b;
  cin >> n >> d;
  int a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  b = a[0];
  b = b + d;
  for (i = 0; i < n; i++) {
    if (a[i] > b) p++;
  }
  cout << p;
  return 0;
}
