def main():

    n, k = [int(x) for x in input().split()]

    dice = [int(x) for x in input().split()]



    expected_accum = []

    for i, p in enumerate(dice):

        ex = (1 + p) / 2

        if i == 0:

            expected_accum.append(ex)

        else:

            expected_accum.append(expected_accum[-1] + ex)



    def gen():

        for start in range(n - k + 1):

            if start == 0:

                yield expected_accum[k - 1]

            else:

                yield expected_accum[start + k - 1] - expected_accum[start - 1]



    print((max(gen())))





if __name__ == '__main__':

    main()

from itertools import accumulate





def main():

    n, k = [int(x) for x in input().split()]

    dice = [int(x) for x in input().split()]



    expected_accum = list(accumulate((1 + p) / 2 for p in dice))



    def gen():

        for start in range(n - k + 1):

            if start == 0:

                yield expected_accum[k - 1]

            else:

                yield expected_accum[start + k - 1] - expected_accum[start - 1]



    print((max(gen())))





if __name__ == '__main__':

    main()

def main():
    n, k = [int(x) for x in input().split()]
    dice = [int(x) for x in input().split()]
    expected_accum = []
    for i, p in enumerate(dice):
        ex = (1 + p) / 2
        if i == 0:
            expected_accum.append(ex)
        else:
            expected_accum.append(expected_accum[-1] + ex)

    def gen():
        for start in range(n - k + 1):
            if start == 0:
                yield expected_accum[k - 1]
            else:
                yield expected_accum[start + k - 1] - expected_accum[start - 1]

    print((max(gen())))


if __name__ == "__main__":
    main()

from itertools import accumulate


def main():
    n, k = [int(x) for x in input().split()]
    dice = [int(x) for x in input().split()]
    expected_accum = list(accumulate((1 + p) / 2 for p in dice))

    def gen():
        for start in range(n - k + 1):
            if start == 0:
                yield expected_accum[k - 1]
            else:
                yield expected_accum[start + k - 1] - expected_accum[start - 1]

    print((max(gen())))


if __name__ == "__main__":
    main()

+from itertools import accumulate + + -    expected_accum = [] -    for i, p in enumerate(dice): -        ex = (1 + p) / 2 -        if i == 0: -            expected_accum.append(ex) -        else: -            expected_accum.append(expected_accum[-1] + ex) +    expected_accum = list(accumulate((1 + p) / 2 for p in dice))