#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int a, b, c, i, j, k, t, n, m;
  int cntmn = 0;
  int cntmx = 0;
  int prevmn = 0;
  int prevmx = 0;
  cin >> n >> k;
  for (i = 1; i <= n; i++) {
    cin >> a;
    if (i == 1) {
      prevmn = prevmx = a;
      continue;
    }
    if (abs(prevmn - a) <= k) {
      cntmn++;
      prevmn = a;
    } else {
      prevmn = min(prevmn, a);
    }
    if (abs(prevmx - a) <= k) {
      cntmx++;
      prevmx = a;
    } else {
      prevmx = max(a, prevmx);
    }
  }
  cout << max(cntmn, cntmx) + 1 << endl;
  return 0;
}
