n,k=map(int,input().split())
a=[int(input()) for _ in range(n)]
dp=[[0 for _ in range(n+1)] for _ in range(2)]
dp[1][1]=1
for i in range(1,n):
    dp[0][i+1]=max(dp[0][i],dp[1][i])
    if abs(a[i]-a[i-1])<=k:
        dp[1][i+1]=max(dp[1][i],dp[0][i])+1
    else:
        dp[1][i+1]=dp[0][i]
print(max(dp[0][-1],dp[1][-1]))