#include <bits/stdc++.h>
const int INF = 1 << 30;
const long long LINF = 1LL << 60;
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n + 1, 0);
  for (long long i = 0; i < (n); ++i) cin >> a[i + 1];
  vector<vector<ll>> dp(n + 3, vector<ll>(2, 0));
  dp[1][1] = 1;
  for (ll i = 2; i <= n; i++) {
    dp[i][0] = max(dp[i - 1][0], dp[i - 1][1]);
    if (abs(a[i] - a[i - 1]) <= k)
      dp[i][1] = max(dp[i - 1][0], dp[i - 1][1]) + 1;
  }
  cout << max(dp[n][0], dp[n][1]) << "\n";
  return 0;
}
