program r20926d
 
implicit none
integer(16) :: n, k, i, j, ans, max
integer(16), allocatable :: a(:)

read *, n, k
allocate(a(1:n))

ans = 0
max = 0

do i = 1, n
 read *, a(i)
end do

do i = 1, n-2
 do j = i, n-1
  if(abs(a(i)-a(i+1))>k) then
   exit
  end if
  if(abs(a(j)-a(j+1))<=k) then
   ans = ans + 1
  end if
 end do
 
 if(max < ans) then
  max = ans
 end if
 
 if(max > n-i) then
  exit
 end if
 
 !print *, ans
 ans = 0
 
end do

print *, max + 1

end program r20926d