#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int dp[n];
  memset(dp, 0, sizeof(dp));
  for (int i = 0; i < n; i++) {
    dp[i] = 0;
  }
  if (abs(a[n - 1] - a[n - 2]) <= k) {
    dp[n - 2] = 1;
  }
  for (int i = n - 3; i >= 0; i--) {
    int c = 0, c1 = 0;
    if (abs(a[i] - a[i + 1]) <= k) {
      c = 1;
    }
    if (abs(a[i] - a[i + 2]) <= k) {
      c1 = 1;
    }
    dp[i] = max(dp[i + 1] + c, dp[i + 2] + c1);
  }
  cout << dp[0] + 1 << endl;
  return 0;
}
