def resolve():
    n, k = map(int, input().split())
    A = []
    dp = [0 for i in range(n)]
    dp[0] = 1
    for _ in range(n):
        A.append(int(input()))

    for i in range(1, n):
        if abs(A[i - 1] - A[i]) <= k:
            dp[i] = dp[i - 1] + 1
        else:
            dp[i] = max(dp[:i])

    print(dp[-1])

resolve()