import scala.io.StdIn.readLine

object Main extends App {

  val Array(n, k) = readLine().split(" ").map(_.toInt)
  val xs = readLine().split(" ").map(_.toDouble)
  val ys = xs.sliding(k).reduceLeft((max, zs) => if (zs.sum > max.sum) zs else max)

  val s = ys.map(z => (z * (1 + z) / 2) / z).sum

  println(s)
}
