program Beg4
  implicit none
  integer :: N,K, i , j
  integer, allocatable:: p(:)
  real :: ssum ,smax

  read(*,*) N, K
  allocate(p(N))

  read(*,*) (p(j), j=1,N)

  smax=0.0
  do i=1,N-K+1
     ssum=0.0
     do j=i,i+K-1
        ssum=ssum+dble(p(j)+1)/2.0
     enddo
     if(ssum.gt.smax) smax=ssum
  enddo
  print*, smax


end program Beg4

