#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream &operator<<(ostream &cout, vector<T> V) {
  cout << "[ ";
  for (auto v : V) cout << v << ' ';
  return cout << ']';
}
template <typename T>
ostream &operator<<(ostream &out, const set<T> &N_A) {
  out << "{ ";
  for (const auto &i : N_A) out << i << ", ";
  return out << "}" << '\n';
}
template <typename T, typename G>
ostream &operator<<(ostream &out, const map<T, G> &N_A) {
  out << "< ";
  for (const auto &i : N_A) out << i << ", ";
  return out << ">" << '\n';
}
template <typename T>
inline istream &operator>>(istream &in, vector<T> &N_A) {
  for (auto &x : N_A) in >> x;
  return in;
}
long long int dp[300005], a[300005];
long long int n, k;
long long int rec(long long int i) {
  if (i >= n) return 1;
  if (dp[i] != -1) return dp[i];
  long long int ans = 0;
  if (i + 1 < n) {
    if (abs(a[i] - a[i + 1]) <= k) {
      ans = 1 + rec(i + 1);
    }
  }
  ans = max(ans, rec(i + 1));
  return dp[i] = ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int _;
  _ = 1;
  while (_--) {
    cin >> n >> k;
    for (long long int i = 0; i < n; i++) {
      dp[i] = -1;
      cin >> a[i];
    }
    for (long long int i = n; i < n + 5; i++) {
      dp[i] = -1;
      a[i] = -1;
    }
    long long int ans = 0;
    for (long long int i = 0; i < n; i++) {
      ans = max(ans, rec(i));
    }
    cout << ans << '\n';
  }
  return 0;
}
