N, K = map(int, input().split())
A = [int(input()) for i in range(N)]

T = 1
ans = []

i = 0
while(i<=N-2):
  a = A[i]
  while (i<=N-2):
    if ( abs(a-A[i]) <= K ):
      T += 1
      a = A[i]
    i += 1
  ans.append(T)
  i += 1
  
print(max(ans))
