program main
      implicit none
      integer :: n, k, i
      integer, allocatable :: p(:)
      real(16), allocatable :: s(:)
      real(16), allocatable :: sk(:)

      read *, n, k
      allocate( p(n) )
      read *, p
      allocate( s(0:n) )
      allocate( sk(n-k+1) )

      s = 0.0
      do i = 1, n
        s(i) = s(i-1)+(1+p(i))/2.0
      end do

      sk = 0.0
      do i = 1, n-k+1
        sk(i) = s(i+k-1)-s(i-1)
      end do

      print *, maxval(sk)

end program main
