function p(d) {
  return (1 + d) * d / 2 / d
}

function main(input) {
  const inputs =input.split('\n')
  const [N, K] = inputs[0].split(' ').map(Number)
  const P = inputs[1].split(' ').map(Number)

  let accSum = []
  for(let i = 0 ; i < N; i++) {
    if (i === 0) {
      accSum[i] = p(P[i])
    } else {
      accSum[i] = p(P[i]) + accSum[i-1]
    }
  }

  let max = 0
  for (let i = K - 1; i < N; i++) {
    if (i === K - 1) {
      max = max < accSum[i] ? accSum[i] : max
    } else {
      const s = accSum[i] - accSum[i-K]
      max = max < s ? s : max
    }
  }
  console.log(max)
}

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