import sys
sys.setrecursionlimit(int(1e9))
N,K = map(int, input().split())
A = [int(input()) for _ in range(N)]

ans = 0
def dfs(idx, lastB, length):
    global ans
    if idx == N:
        ans = max(ans, length)
        return 

    dfs(idx+1, lastB, length)
    if abs(lastB-A[idx]) <= K:
        dfs(idx+1, A[idx], length+1)

dfs(0, A[0], 1)
dfs(0, A[1], 0)
print(ans-1)
