
function Main(input) {
  input = input.trim().split("\n").map(function(x) { return x.split(" ")});
  var L1 = input[0].map(e => parseInt(e, 10));
  var N = L1[0];
  var K = L1[1];
  var vec_p = input[1].map(e => parseInt(e, 10));
  var tmpSum = 0;
  var tmpSet = [];
  var changed, ans;
  for (var i = 0; i < K; i++){
    tmpSum += vec_p[i];
    tmpSet.push(vec_p[i]);
  }
  ans = tmpSum;
  for (var i = K; i < N; i++){
    changed = i % K;
    tmpSum += (vec_p[i] - tmpSet[changed]);
    tmpSet[changed] = vec_p[i];
    if (tmpSum > ans) ans = tmpSum;
  }
  ans = (ans + K) / 2;
  console.log(ans);
}   

Main(require("fs").readFileSync("/dev/stdin", "utf8"));