N, K = map(int, input().split())
A = list(int(input()) for _ in range(N))

dp = [0] * (N+1)
for i, a in enumerate(A):
    dp[i+1] = dp[i]
    if abs(A[i] - A[i-1]) <= K:
        dp[i+1] += 1

print(dp[-1])