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