fun main(args:Array<String>) {
    val (n,m) = readLine()!!.split(" ").map { it.toInt() }
    val dice = readLine()!!.split(" ").map { it.toDouble().let { (1+it)/2 } }
    val subTotal = dice.take(m).sum()
    val subTotalList = mutableListOf(subTotal)
    if(n > m) {
        for(i in (m until n)) {
            val tmp = subTotalList.last() + dice[i] - dice[i-m]
            subTotalList.add(tmp)
        }
    }
    println(subTotalList.max())
}
