#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A;
  vector<vector<int>> dp(N + 1, vector<int>(2, 0));
  dp[0][0] = 0;
  dp[0][1] = 1;
  for (int i = 0; i < N; i++) {
    int in;
    cin >> in;
    A.push_back(in);
  }
  for (int i = 0; i < N; i++) {
    if (abs(A[i] - A[i + 1]) <= K) {
      dp[i + 1][1] = max(dp[i][0], dp[i][1]) + 1;
    } else {
      dp[i + 1][1] = max(dp[i][0], dp[i][1]);
    }
    dp[i + 1][0] = max(dp[i][0], dp[i][1]);
  }
  cout << max(dp[N][1], dp[N][0]) << endl;
  return 0;
}
