def resolve():
    from collections import deque
    n, k = map(int, input().split())
    A = []
    for _ in range(n):
        A.append(int(input()))

    ans = 0
    d = deque([0])
    while len(d) > 0:
        c = 1
        start = d.popleft()
        j = 0
        while start + j < n - 1:
            if abs(A[start + j] - A[start + j + 1]) > k:
                d.append(start + j + 1)
            else:
                start += j
                j = 0
                c += 1
            j += 1
        ans = max(ans, c)

    print(ans)

resolve()