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 max = 0
  for(let i = 0 ; i + K - 1< N; i++) {
    // console.log('c:', i)
    let s = 0
    for (let j = i; j <= i + K - 1; j++) {
      // console.log(P[j])
      s += p(P[j])
    }
    if (max < s) max = s
  }
  console.log(max)
}

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