# 初期入力

N,K = (int(x) for x in input().split(" "))

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



# １からnまでの和 S_n = n*(n+1)/2　さいころの期待値は　S_n /n

kitaiti = [ (i+1)/2 for i in A ]



#　N個のサイコロの期待値の累積和 S

S = [0] * (N +1)

#S[0] = kitaiti[0]

#S =[0]

# S[0] = 0

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

    S[i] = S[i-1] + kitaiti[i-1]



# 隣接するK個の期待値の和 S_K

S_K = []

for i,v in enumerate(S[:(-1)*K ]):

    S_K.append( S[i + K ] - S[i] )

"""

print(kitaiti)

print(S)

print(S_K)

"""

print((max(S_K)))
# 初期入力

#import numpy as np

import sys

input = sys.stdin.readline

N,K = (int(i) for i in input().split())

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



expected_value =[(i+1)/2 for i in p] #各さいころの期待値



#隣接する数列の和

adjacent_sum =[0]*N

adjacent_sum[0] =sum(expected_value[:K])

ans =[0]*N

ans[0] =adjacent_sum[0]

for i in range(1,N-K+1):

    adjacent_sum[i] =adjacent_sum[i-1] -expected_value[i-1] +expected_value[i+K-1]

    ans[i] =adjacent_sum[i] 

print((max(ans)))
# 初期入力
N, K = (int(x) for x in input().split(" "))
A = list(map(int, input().split()))
# １からnまでの和 S_n = n*(n+1)/2　さいころの期待値は　S_n /n
kitaiti = [(i + 1) / 2 for i in A]
# 　N個のサイコロの期待値の累積和 S
S = [0] * (N + 1)
# S[0] = kitaiti[0]
# S =[0]
# S[0] = 0
for i in range(1, N + 1):
    S[i] = S[i - 1] + kitaiti[i - 1]
# 隣接するK個の期待値の和 S_K
S_K = []
for i, v in enumerate(S[: (-1) * K]):
    S_K.append(S[i + K] - S[i])
"""
print(kitaiti)
print(S)
print(S_K)
"""
print((max(S_K)))

# 初期入力
# import numpy as np
import sys

input = sys.stdin.readline
N, K = (int(i) for i in input().split())
p = list(map(int, input().split()))
expected_value = [(i + 1) / 2 for i in p]  # 各さいころの期待値
# 隣接する数列の和
adjacent_sum = [0] * N
adjacent_sum[0] = sum(expected_value[:K])
ans = [0] * N
ans[0] = adjacent_sum[0]
for i in range(1, N - K + 1):
    adjacent_sum[i] = (
        adjacent_sum[i - 1] - expected_value[i - 1] + expected_value[i + K - 1]
    )
    ans[i] = adjacent_sum[i]
print((max(ans)))

-N, K = (int(x) for x in input().split(" ")) -A = list(map(int, input().split())) -# １からnまでの和 S_n = n*(n+1)/2　さいころの期待値は　S_n /n -kitaiti = [(i + 1) / 2 for i in A] -# 　N個のサイコロの期待値の累積和 S -S = [0] * (N + 1) -# S[0] = kitaiti[0] -# S =[0] -# S[0] = 0 -for i in range(1, N + 1): -    S[i] = S[i - 1] + kitaiti[i - 1] -# 隣接するK個の期待値の和 S_K -S_K = [] -for i, v in enumerate(S[: (-1) * K]): -    S_K.append(S[i + K] - S[i]) -""" -print(kitaiti) -print(S) -print(S_K) -""" -print((max(S_K))) +# import numpy as np +import sys + +input = sys.stdin.readline +N, K = (int(i) for i in input().split()) +p = list(map(int, input().split())) +expected_value = [(i + 1) / 2 for i in p]  # 各さいころの期待値 +# 隣接する数列の和 +adjacent_sum = [0] * N +adjacent_sum[0] = sum(expected_value[:K]) +ans = [0] * N +ans[0] = adjacent_sum[0] +for i in range(1, N - K + 1): +    adjacent_sum[i] = ( +        adjacent_sum[i - 1] - expected_value[i - 1] + expected_value[i + K - 1] +    ) +    ans[i] = adjacent_sum[i] +print((max(ans)))