def kitaichi(x):
    return x * (x+1) / (2 * x)

def main():
    n, k = map(int, input().split())
    inlis = tuple(map(int, input().split()))
    kitalis = list(map(kitaichi, inlis))
    kitadic = {}
    kitadic[0] = kitalis[0] 
    for i in range(1, n):
        kitadic[i] = kitadic[i-1] + kitalis[i]
       
    tmp = 0
    if n == k:
        print(kitadic[n-1])
    else:
        for i in range(n - k):
            atai = kitadic[i+k] - kitadic[i]
            if tmp < atai:
                tmp = atai
        print(tmp)
        exit()



    
if __name__ == "__main__":
    main() def kitaichi(x):
    return x * (x+1) / (2 * x) kitaichi return x * (x+1) / (2 * x) x * (x+1) / (2 * x) x * (x+1) x x+1 x 1 2 * x 2 x x x def main():
    n, k = map(int, input().split())
    inlis = tuple(map(int, input().split()))
    kitalis = list(map(kitaichi, inlis))
    kitadic = {}
    kitadic[0] = kitalis[0] 
    for i in range(1, n):
        kitadic[i] = kitadic[i-1] + kitalis[i]
       
    tmp = 0
    if n == k:
        print(kitadic[n-1])
    else:
        for i in range(n - k):
            atai = kitadic[i+k] - kitadic[i]
            if tmp < atai:
                tmp = atai
        print(tmp)
        exit()



     main n, k = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split k inlis = tuple(map(int, input().split())) inlis tuple(map(int, input().split())) tuple map(int, input().split()) map int input().split() ().split () input split kitalis = list(map(kitaichi, inlis)) kitalis list(map(kitaichi, inlis)) list map(kitaichi, inlis) map kitaichi inlis kitadic = {} kitadic {} kitadic[0] = kitalis[0] kitadic[0] kitadic 0 kitalis[0] kitalis 0 for i in range(1, n):
        kitadic[i] = kitadic[i-1] + kitalis[i]
       
     i range(1, n) range 1 n kitadic[i] = kitadic[i-1] + kitalis[i] kitadic[i] kitadic i kitadic[i-1] + kitalis[i] kitadic[i-1] kitadic i-1 i 1 kitalis[i] kitalis i tmp = 0 tmp 0 if n == k:
        print(kitadic[n-1])
    else:
        for i in range(n - k):
            atai = kitadic[i+k] - kitadic[i]
            if tmp < atai:
                tmp = atai
        print(tmp)
        exit()



     n == k n k print(kitadic[n-1]) print kitadic[n-1] kitadic n-1 n 1 for i in range(n - k):
            atai = kitadic[i+k] - kitadic[i]
            if tmp < atai:
                tmp = atai
         i range(n - k) range n - k n k atai = kitadic[i+k] - kitadic[i] atai kitadic[i+k] - kitadic[i] kitadic[i+k] kitadic i+k i k kitadic[i] kitadic i if tmp < atai:
                tmp = atai
         tmp < atai tmp atai tmp = atai tmp atai print(tmp) print tmp exit() exit if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def kitaichi(x):
    return x * (x+1) / (2 * x) def kitaichi(x):
    return x * (x+1) / (2 * x) kitaichi def main():
    n, k = map(int, input().split())
    inlis = tuple(map(int, input().split()))
    kitalis = list(map(kitaichi, inlis))
    kitadic = {}
    kitadic[0] = kitalis[0] 
    for i in range(1, n):
        kitadic[i] = kitadic[i-1] + kitalis[i]
       
    tmp = 0
    if n == k:
        print(kitadic[n-1])
    else:
        for i in range(n - k):
            atai = kitadic[i+k] - kitadic[i]
            if tmp < atai:
                tmp = atai
        print(tmp)
        exit()



     def main():
    n, k = map(int, input().split())
    inlis = tuple(map(int, input().split()))
    kitalis = list(map(kitaichi, inlis))
    kitadic = {}
    kitadic[0] = kitalis[0] 
    for i in range(1, n):
        kitadic[i] = kitadic[i-1] + kitalis[i]
       
    tmp = 0
    if n == k:
        print(kitadic[n-1])
    else:
        for i in range(n - k):
            atai = kitadic[i+k] - kitadic[i]
            if tmp < atai:
                tmp = atai
        print(tmp)
        exit()



     main
def kitaichi(x):
    return x * (x+1) / (2 * x)

def main():
    n, k = map(int, input().split())
    inlis = tuple(map(int, input().split()))
    kitalis = list(map(kitaichi, inlis))
    kitadic = {}
    kitadic[0] = kitalis[0] 
    for i in range(1, n):
        kitadic[i] = kitadic[i-1] + kitalis[i]
       
    tmp = 0
    if n == k:
        print(kitadic[n-1])
    else:
        for i in range(n - k):
            atai = kitadic[i+k] - kitadic[i]
            if tmp < atai:
                tmp = atai
        print(tmp)
        exit()



    
if __name__ == "__main__":
    main()
