#include <atcoder/all>
using namespace std;
using namespace atcoder;

using mint = modint1000000007;

const int max_n = 300010;

int n, k;
int dp[max_n],a[max_n];

int main(){
    cin >> n >> k;
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    dp[0] = 1;
    for(int i=1; i<n; i++){
        dp[i] = dp[i-1];
        if(abs(a[i-1]-a[i]) <= k) {
            dp[i] = max(dp[i], dp[i-1]+1);
        }
    }
    int ans = -1;
    for(int i = 0; i < n; i++){
        ans = max(ans, dp[i]);
    }
    cout << ans << endl;
}