Scanf.scanf "%d %d" (fun n k ->
    let arr = Array.init n (fun _ -> Scanf.scanf " %d" (fun p -> p)) in
    let sum =
        let rec loop i acc =
            if i = k then acc else loop (i + 1) (acc + arr.(i))
        in
        loop 0 0
    in
    let rec loop i cur mx =
        if i = n then mx else
            let cur = cur + arr.(i) - arr.(i - k) in
            loop (i + 1) cur (max mx cur)
    in
    let mx = loop k sum sum in
    let ex = float (mx + k) /. 2. in
    Printf.printf "%f\n" ex
)