import sys

from functools import lru_cache

def input(): return sys.stdin.readline().rstrip()



sys.setrecursionlimit(10 ** 9)



@lru_cache(maxsize=None)

def calc(n):

    if n == 1:

        return 1

    else:

        return n + calc(n - 1)



def main():

    N, K = list(map(int, input().split()))

    P = tuple(map(int, input().split()))



    l = 0

    sum_v = 0

    max_v = 0

    max_i = 0

    ind = 0

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

        while l < K:

            sum_v += P[ind]

            ind += 1

            l += 1

        if sum_v > max_v:

            max_v = sum_v

            max_i = i

        l -= 1

        sum_v -= P[i]

    print((sum([calc(p) / p for p in P[max_i:max_i+K]])))



if __name__ == '__main__':

    main()

import sys

from itertools import accumulate

def input(): return sys.stdin.readline().rstrip()



def main():

    N, K = list(map(int, input().split()))

    P = tuple(map(int, input().split()))



    sum_ls = tuple(accumulate(list(range(max(P) + 1))))

    acc_P = [0] + list(accumulate([sum_ls[p] / p for p in P]))



    ans = 0

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

        v = acc_P[i+K] - acc_P[i]

        if v > ans:

            ans = v

    print(ans)



if __name__ == '__main__':

    main()

import sys
from functools import lru_cache


def input():
    return sys.stdin.readline().rstrip()


sys.setrecursionlimit(10**9)


@lru_cache(maxsize=None)
def calc(n):
    if n == 1:
        return 1
    else:
        return n + calc(n - 1)


def main():
    N, K = list(map(int, input().split()))
    P = tuple(map(int, input().split()))
    l = 0
    sum_v = 0
    max_v = 0
    max_i = 0
    ind = 0
    for i in range(N - K + 1):
        while l < K:
            sum_v += P[ind]
            ind += 1
            l += 1
        if sum_v > max_v:
            max_v = sum_v
            max_i = i
        l -= 1
        sum_v -= P[i]
    print((sum([calc(p) / p for p in P[max_i : max_i + K]])))


if __name__ == "__main__":
    main()

import sys
from itertools import accumulate


def input():
    return sys.stdin.readline().rstrip()


def main():
    N, K = list(map(int, input().split()))
    P = tuple(map(int, input().split()))
    sum_ls = tuple(accumulate(list(range(max(P) + 1))))
    acc_P = [0] + list(accumulate([sum_ls[p] / p for p in P]))
    ans = 0
    for i in range(N - K + 1):
        v = acc_P[i + K] - acc_P[i]
        if v > ans:
            ans = v
    print(ans)


if __name__ == "__main__":
    main()

-from functools import lru_cache +from itertools import accumulate -sys.setrecursionlimit(10**9) - - -@lru_cache(maxsize=None) -def calc(n): -    if n == 1: -        return 1 -    else: -        return n + calc(n - 1) - - -    l = 0 -    sum_v = 0 -    max_v = 0 -    max_i = 0 -    ind = 0 +    sum_ls = tuple(accumulate(list(range(max(P) + 1)))) +    acc_P = [0] + list(accumulate([sum_ls[p] / p for p in P])) +    ans = 0 -        while l < K: -            sum_v += P[ind] -            ind += 1 -            l += 1 -        if sum_v > max_v: -            max_v = sum_v -            max_i = i -        l -= 1 -        sum_v -= P[i] -    print((sum([calc(p) / p for p in P[max_i : max_i + K]]))) +        v = acc_P[i + K] - acc_P[i] +        if v > ans: +            ans = v +    print(ans)