#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  queue<P> q;
  int length = 1;
  int now = a[0];
  bool ok = true;
  for (int i = 0; i < (n - 1); i++) {
    if (max(now - a[i + 1], a[i + 1] - now) <= k) {
      length++;
      now = a[i + 1];
      ok = false;
    } else {
      ok = ok ^ true;
      if (ok) {
        q.push(P(i - 1, length));
      }
    }
  }
  int l, r = a[0];
  int ans = 2 - q.size();
  while (!q.empty()) {
    l = r;
    r = a[q.front().first];
    int sz = q.front().second;
    q.pop();
    while (l + 1 <= r) {
      now = l + 1;
      length = 1;
      for (int si = l + 1; si < r; si++) {
        if (max(now - a[si + 1], a[si + 1] - now) <= k) {
          length++;
          now = a[si + 1];
        }
      }
      ++l;
      sz = max(sz, length);
    }
    ans += sz;
  }
  cout << ans << endl;
  return 0;
}
