from itertools import accumulate



n,k=list(map(int,input().split()))

p=list(map(int,input().split()))



x=[]

for i in p:

 x.append((i+1)/2)



b=[0]+list(accumulate(x))



mm=0

inx=-1

for i in range(len(b)-k):

 if b[i+k]-b[i]>=mm:

  inx=i

  mm=b[i+k]-b[i]





ans=0

for j in range(inx,inx+k):

  ans+=((p[j]*(p[j]+1))*0.5)*(1/p[j])



print(ans)
n,k=list(map(int,input().split()))

p=list(map(int,input().split()))



b=[0]

for i in range(1,n+1):

  b.append(b[i-1]+p[i-1])



max_i=-1

max_v=0

for i in range(1,n+1-k):

  if b[i+k]-b[i]>max_v:

    max_i=i

    max_v=b[i+k]-b[i]

ans=0

for i in range(k):

  ans+=(p[max_i+i]+1)/2

print(ans)
from itertools import accumulate

n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
x = []
for i in p:
    x.append((i + 1) / 2)
b = [0] + list(accumulate(x))
mm = 0
inx = -1
for i in range(len(b) - k):
    if b[i + k] - b[i] >= mm:
        inx = i
        mm = b[i + k] - b[i]
ans = 0
for j in range(inx, inx + k):
    ans += ((p[j] * (p[j] + 1)) * 0.5) * (1 / p[j])
print(ans)

n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
b = [0]
for i in range(1, n + 1):
    b.append(b[i - 1] + p[i - 1])
max_i = -1
max_v = 0
for i in range(1, n + 1 - k):
    if b[i + k] - b[i] > max_v:
        max_i = i
        max_v = b[i + k] - b[i]
ans = 0
for i in range(k):
    ans += (p[max_i + i] + 1) / 2
print(ans)

-from itertools import accumulate - -x = [] -for i in p: -    x.append((i + 1) / 2) -b = [0] + list(accumulate(x)) -mm = 0 -inx = -1 -for i in range(len(b) - k): -    if b[i + k] - b[i] >= mm: -        inx = i -        mm = b[i + k] - b[i] +b = [0] +for i in range(1, n + 1): +    b.append(b[i - 1] + p[i - 1]) +max_i = -1 +max_v = 0 +for i in range(1, n + 1 - k): +    if b[i + k] - b[i] > max_v: +        max_i = i +        max_v = b[i + k] - b[i] -for j in range(inx, inx + k): -    ans += ((p[j] * (p[j] + 1)) * 0.5) * (1 / p[j]) +for i in range(k): +    ans += (p[max_i + i] + 1) / 2