n, k = map(int, input().split())

li = [input() for _ in range(n)]

ans = 0

for bit in range(1 << n):
    lis = []
    for i in range(n):
        if bit & (1 << i):
            lis.append(int(li[i]))

    flag = True

    for i in range(len(lis)):
        if flag:
            if i != 0:
                if abs(lis[i] - lis[i-1]) > k:
                    flag = False

    if flag:
        ans = max(ans, len(lis))

print(ans)
