program answer
  implicit none
  integer(8) :: i, j, N, K, ans, f, tmp, b, c
  integer(8), allocatable :: A(:)
  read(*,*) N, K
  allocate(A(N))
  do i = 1, N
     read(*,*) A(i)
  end do
  ans=1
  do i = 1, N-1
     if(abs(A(i)-A(i+1))<=K) then
        f=i
        exit
     end if
  end do

  ans=1
  do i = 1, f
     tmp=1
     b=A(i)
     j=1
     do
        if(i+j>=N+1) then
           exit
        end if
        if(abs(A(i+j)-b)<=K) then
           tmp=tmp+1
           b=A(i+j)
           j=j+1
        else
           j=j+1
        end if
     end do
     ans=max(ans,tmp)
  end do
  
  write(*,*) ans
  stop
 end program answer