#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const long long mod = 1e9 + 7;
const int N = 3e5 + 10, M = 1e6 + 10;
const long long INF = 1e18;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
int n, k;
int a[N];
bool cmp(int a, int b) { return abs(a - b) <= k; }
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1, cmp);
  int num = 1;
  for (int i = 2; i <= n; i++) {
    if (abs(a[i] - a[i - 1]) > k) break;
    num++;
  }
  cout << num << endl;
  return 0;
}
