#include <bits/stdc++.h>
using namespace std;
long long int dx[] = {-1, +1, 0, 0, +1, -1, +1, -1};
long long int dy[] = {0, 0, -1, +1, +1, +1, -1, -1};
const long long int mx = 3e5 + 123;
const long long int MOD = 1e9 + 7;
const long long int INF = LLONG_MAX;
template <class T>
T power(T a, T b) {
  a %= MOD;
  if (!a) return 0;
  T p = 1;
  while (b > 0) {
    if (b & 1) {
      p *= a;
      p %= MOD;
    }
    a *= a;
    a %= MOD;
    b = b >> 1;
  }
  return p;
}
template <class T>
void print(vector<T> &v) {
  for (T u : v) {
    cout << u << " ";
  }
  cout << endl;
}
template <class T>
T gcd(T a, T b) {
  return (b != 0 ? gcd<T>(b, a % b) : a);
}
template <class T>
T lcm(T a, T b) {
  return (a / gcd<T>(a, b) * b);
}
long long int ans;
long long int b[mx], a, k, dp[mx];
long long int solve(long long int i, long long int j) {
  if (i == a - 1 || j == a - 1) return dp[i] = (abs(b[i] - b[j])) <= k;
  if (dp[i] != -1) return dp[i];
  long long int ret1 = 0, ret2 = 0;
  if (abs(b[i] - b[j]) <= k) {
    ret1 = max((1 + solve(j, j + 1)), (solve(i, j + 1)));
  } else
    ret2 = solve(i, j + 1);
  return dp[i] = max(ret1, ret2);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ;
  cin >> a >> k;
  for (long long int i = 0; i < a; i++) {
    cin >> b[i];
  }
  memset(dp, -1, sizeof(dp));
  ans = 0;
  cout << solve(0, 1) + 1 << endl;
  return 0;
}
