#include <bits/stdc++.h>
using namespace std;
long long int INF = 1000000007;
pair<long long int, long long int> x[300005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int i, j;
  long long int n, k;
  cin >> n >> k;
  int arr[n];
  for (i = 0; i < n; i++) cin >> arr[i];
  int cur = 1;
  x[1].first = arr[0];
  x[1].second = arr[0];
  for (i = 1; i < n; i++) {
    int f = 0;
    long long int a = arr[i] - k;
    long long int b = arr[i] + k;
    if (x[cur].second >= a && x[cur].second <= b) {
      f = 1;
    } else if (x[cur].first >= a && x[cur].first <= b) {
      f = 1;
    }
    if (f == 1) {
      cur++;
      x[cur].first = arr[i];
      x[cur].second = arr[i];
    }
    if (f == 0) {
      int ki = 0;
      for (j = cur - 1; j > 1; j--) {
        if (x[j].second >= a && x[j].second <= b) {
          ki = 1;
          if (arr[i] < x[j].first) x[j].first = arr[i];
          if (arr[i] > x[j].second) x[j].second = arr[i];
          break;
        } else if (x[j].first >= a && x[j].first <= b) {
          ki = 1;
          if (arr[i] < x[j].first) x[j].first = arr[i];
          if (arr[i] > x[j].second) x[j].second = arr[i];
          break;
        }
      }
      if (ki == 0) {
        if (arr[i] < x[1].first) x[1].first = arr[i];
        if (arr[i] > x[1].second) {
          x[1].second = arr[i];
        }
      }
    }
  }
  cout << cur << endl;
  return 0;
}
