Problem:
Score : 400 points

Problem Statement

We have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.

We will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.

Constraints

1 ≤ K ≤ N ≤ 200000

1 ≤ p_i ≤ 1000

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N K
p_1 ... p_N

Output

Print the maximum possible value of the expected value of the sum of the numbers shown.

Your output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.

Sample Input 1

5 3
1 2 2 4 5

Sample Output 1

7.000000000000

When we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.

Sample Input 2

4 1
6 6 6 6

Sample Output 2

3.500000000000

Regardless of which die we choose, the expected value of the number shown is 3.5.

Sample Input 3

10 4
17 13 13 12 15 20 10 13 17 11

Sample Output 3

32.000000000000

Solution in Rust (1.15.1) (judge verdict: Wrong Answer)

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

// Test Code
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
}

use std::collections::HashMap;


fn main() {
    println!("{}", solve(&stdin!()));
}

fn solve(src: &str) -> String {
    input!{
        source = src,
        n: usize,
        k: usize,
        pn: [usize; n],
    }

    let pnn = expected_values(pn);
    let mut max = -1.0;
    let mut old = -1.0;
    for i in 0..(n - k + 1) {
        let mut sum = 0.0;
        if old < 0.0 {
            for j in i..(i+k) {
                sum += pnn[j];
            }
        } else {
            sum = old - pnn[i - 1] + pnn[i + 1];
            old = sum;
        }


        if max < sum {
            max = sum;
        }
    }


    return max.to_string();

}


fn expected_values(ns: Vec<usize>) -> Vec<f64> {
    // let mut ev: HashMap<usize, f64> = HashMap::new();
    let mut vec: Vec<f64> = Vec::new();
    
    for p in ns.iter() {
        vec.push(1.0 + (*p as f64) / 2.0);
    }
    // for n in ns.iter() {
    //     let mut a : f64 = match ev.get(n) {
    //         Some(x) => *x,
    //         None => -1.0
    //     };


    //     if a < 0.0 {
    //         let mut sum: usize = 0;
    //         for i in 1..(n+1) {
    //             sum += i;
    //         }
    //         a = (sum as f64) / (*n as f64);
    //         ev.insert(*n, a);
    //     } else {
    //         // println!("skip, {} - {}", n, a);
    //     }

    //     vec.push(a);
    // }

    return vec;
}

// fn expected_value(n: usize) -> f64 {
//     let mut sum: usize = 0;
//     for i in 1..(n+1) {
//         sum += i;
//     }
//     (sum as f64) / (n as f64)
// }