#include <atcoder/all>
#include <bits/stdc++.h>

#define INF 1e9
using namespace std;
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
typedef long long ll;


vector<int> memo,v;
int N,K;
int depth = 0;
void dfs(int i) {
    auto ai = i;
    if (memo[i] != -1) {
        depth = memo[i];
        return;
    }
    auto val = v[i];
    i++;
    if (i == N) return;
    while(abs(v[i] - val) > K) {
        i++;
        if (i == N) return;
    }
    // cerr << "next :" << i << endl;
    dfs(i);
    depth++;
    memo[ai] =  depth;
    // cerr << "called in " << depth << endl;
}

void solve() {
    cin >> N >> K;
    v.resize(N); memo.resize(N,-1);
    REP(i,N) cin >> v[i];
    REP(i,N) {
        // cerr << "** first take : " << i << endl;
        depth = 1;
        dfs(i);
    }
    REP(i,N) cerr << memo[i] << endl;
    cout << *max_element(ALL(memo)) << endl;
}

int main() {
    solve();
    return 0;
}