"use strict";

const main = arg => {
    // 標準入力の不要な空白と改行を削除し、配列に格納する
    const input = arg.trim().split("\n");
    const N = Math.floor(input[0].split(" ")[0]);
    const K = Math.floor(input[0].split(" ")[1]);
    const pArray = input[1].split(" ").map(n => Math.floor(n));

    const kitaichi = i => (i + 1) / 2;
    const pArrayKitaichi = pArray.map(item => kitaichi(item)); 

    const cumulativeSum = (array) => {
        let cumulativeSumArray = [0];
        array.reduce((a, i) => {
            a === 0 ? cumulativeSumArray.push(i) : cumulativeSumArray.push(a + i);
            return a + i
        }, 0)
        return cumulativeSumArray;
    }

    const cumulativeSumArrayKitaichi = cumulativeSum(pArrayKitaichi);
    
    // console.log(N,K,pArray);
    // console.log(cumulativeSumArrayKitaichi);

    let sumArray = [];
    for (let i=K; i<N+1; i++) {
        sumArray.push(cumulativeSumArrayKitaichi[i] - cumulativeSumArrayKitaichi[i-K]);
    }
    console.log(Math.max(...sumArray));
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));  