  Program Main

    Implicit None

    Real*8               :: q    
    Integer, Allocatable :: p(:),s(:)
    Integer(8)           :: i,j,N,K,max_s,l

    N = 0; K = 0; max_s = 0
    Read(*,*) N,K
    Allocate (p(N)); p(:) = 0
    Allocate (s(N)); s(:) = 0
    Read(*,*)(p(i),i=1,N)

    Do i = 1,N-K+1
       Do j = i,i+K-1
          s(i) = s(i) + p(j)
       Enddo
       If (s(i) > max_s) then
          max_s = s(i)
          l = i
       Endif
    Enddo

    Do i = l,l+K-1
       q = q + (Dble(s(i))+1.0d0)/2.0d0
    Enddo

    Write(*,"(F0.7)") q



  End Program
