#include<bits/stdc++.h>
using namespace std ;

// Template START
#define endl "\n"
#define async ios_base::sync_with_stdio(false); cin.tie(NULL);
#define Int long long int
#define all(y) y.begin(), y.end()
#define present( x, y ) (x.find( y ) != x.end())
const int mod = (int)1e9 + 7 ;
template<class T>
auto matrix( int r, int c, T v ){
    return vector<vector<T>>( r, vector<T>( c, v ) ) ;
}
template<class T>
auto matrix( int o1, int o2, int o3, T v ){ 
    return vector<vector<vector<T>>>( o1, vector<vector<T>>( o2, vector<T>( o3, v ) ) ) ;
}
#define v vector
int power( int x, int n ){
    if( n == 0 ) return 1 ;
    else if( n & 1 ) return ( x * power( (x*x) % mod, n / 2 ) ) % mod ;
    return power( (x*x) % mod, n / 2 ) % mod ;
}
// Template END
v<int> dp((int)3e5 + 1, -1) ;
int rec( v<int> &a, int &n, int &k, int i ){
    if( i == n ) return 0 ;
    if( i == n - 1 ) return 1 ;
    int res = 1 ;
    if( dp[i] != -1 ) return dp[i] ;
    if( abs( a[i+1] - a[i] ) <= k ) {
        res = max( res, rec(a, n, k, i + 1) + 1 ) ;
    } 
    res = max( res, rec(a, n, k, i + 1) ) ;
    return dp[i] = res ;
}

signed main(){
    async ; 
    int n, k ; cin >> n >> k ;
    v<int> a(n) ;
    for( int i = 0 ; i < n ; i++ ){
        cin >> a[i] ;
    }
    // code here
    cout << rec( a, n, k, 0 ) ;
    return 0 ;   
}          