#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> vec(n);
  long long i;
  for (i = 0; i < n; i++) cin >> vec[i];
  long long dp[n];
  for (i = 0; i < n; i++) dp[i] = 1;
  for (i = 1; i < n; i++) {
    dp[i] = dp[i - 1];
    if (abs(vec[i] - vec[i - 1]) <= k) dp[i] = 1 + dp[i - 1];
  }
  cout << *max_element(dp, dp + n);
}
