N, K = map(int,input().split())
A = []
for i in range(N):
    a = int(input())
    A.append(a)

# dp[i] iを含んで選んだときの最大個数
dp = [-1] * N
dp[0] = 0
for i in range(N-1):
    if abs(A[i]-A[i+1])<=K:
        dp[i+1] = max(dp[i+1],dp[i]+1)
    dp[i+1] = max(dp[i+1],dp[i])

print(max(dp)+1)