n,k=map(int,input().split())
a=[None]*n
m=0
lian=0
a0=int(input())
a[0]=a0
for i in range(1,n):
  a1=int(input())
  a[i]=a1
  if a1-a0 >k:
    pass
  elif a0-a1>k:
    pass
  else:
    lian+=1
    if lian>m:
      m=lian
    a0=int(a1)
m1=0
lian=0
a0=a[n-1]
for i in range(2,n+1):
  a1=a[n-i]
  if a1-a0 >k:
    pass
  elif a0-a1>k:
    pass
  else:
    lian+=1
    if lian>m1:
      m1=lian
    a0=int(a1)
if m>m1:
  print(m+1)
else:
  print(m1+1)