! 2020.2.9
!
      program answer
      implicit none
      integer :: N,K
      integer,allocatable,dimension(:) :: p
      integer,allocatable,dimension(:) :: su_p
      integer :: i,j
!
      read(*,*) N,K
      allocate(p(N),su_p(N-K+1))
      read(*,*) (p(i),i=1,N)
!
      su_p = 0
      do i=1,N-K+1
        do j=i,i+K-1
          su_p(i) = su_p(i) + p(j)
        end do
      end do
      call quicksort(N-K+1,su_p,1,N-K+1)
      write(*,*) dble(su_p(N-K+1)+K)/2.0d0
      end program answer
!
!-------------------------------------------------
      recursive subroutine quicksort(n,x,l,r)
!-------------------------------------------------
! Variables I/O
!-------------------------------------------------
! n     ...  the number of data (IN) : integer
! x(i)  ...  data (INOUT) : integer
! l     ...  the smallest label in a sorted region
!            (compute label)
! r     ...  the largest label in a sorted region
!            (compute label)
!-------------------------------------------------
! Variables (The others)
!-------------------------------------------------
! c     ...  the average of l and r : (l+r)/2
! ls    ...  the smallest label in a sorted region
!            (Input label)
! i     ...  the largest label in a sorted region
!            (Input label)
!-------------------------------------------------
! Contain
!-------------------------------------------------
! Subroutine : swap(a,b) : swaping a for b
!-------------------------------------------------
      implicit none
      integer,intent(in) :: n,l,r
      integer,dimension(n),intent(inout) :: x
      integer :: c,ls,i
!
      if(l < r) then
        c = (l+r) / 2 ! representative value
        call swap(x(l),x(c))
        ls = l
        do i=l+1,r
          if(x(i) < x(l)) then
            ls = ls + 1
            call swap(x(ls),x(i))
          end if
        end do
        call swap(x(ls),x(l))
        call quicksort(n,x,l,ls-1)
        call quicksort(n,x,ls+1,r)
      end if
      contains
!-------------------------------------------------
      subroutine swap(a,b)
!-------------------------------------------------
        integer,intent(inout) :: a,b
        integer :: w
        w=a
        a=b
        b=w
      end subroutine swap
      end subroutine quicksort
!