#include <bits/stdc++.h>
using namespace std;
long long int exp(long long int x, long long int y) {
  if (y == 0) return 1;
  if (y == 1) return x;
  if (y % 2 == 0)
    return exp(x, y / 2) * exp(x, y / 2);
  else
    return x * exp(x, y / 2) * exp(x, y / 2);
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return (a * b) / gcd(a, b);
}
int l;
long long int fact(long long int x) {
  if (x == 1)
    return 1;
  else
    return x * fact(x - 1);
}
bool isPrime(int x) {
  int ans = 0;
  for (int i = 2; i <= sqrt(x); ++i) {
    if (x % i == 0) {
      ans = 1;
      i = x;
    }
  }
  if (ans == 0)
    return true;
  else
    return false;
}
int min3(int a, int b, int c) { return min(min(a, b), c); }
long long int modulo = 1000000007;
long long int nCr(long long int n, long long int r) {
  long long int ans = 1;
  for (long long int i = 0; i <= r - 1; ++i) {
    ans = ans * (n - i) / (i + 1);
    if (ans > modulo) ans = ans % modulo;
  }
  return ans;
}
void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n, 0);
  for (int i = 0; i < n; ++i) cin >> v[i];
  int dp[n + 1];
  for (int i = 0; i <= n; ++i) dp[i] = 0;
  int mx = v[0], mn = v[0];
  int curr = 1;
  for (int i = 1; i <= n; ++i) {
    if (abs(v[i] - v[i - 1]) <= k || abs(v[i] - v[i - 1]) <= k) {
      dp[i] = 1 + dp[i - 1];
    } else
      dp[i] = curr;
    curr = max(curr, dp[i]);
  }
  cout << dp[n] << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
