awk -M '\
NR==1{N=$1; K=$2}
NR==2{split($0,A)}
END{
    for(i=1;i<=N;i++){
        a=(A[i]+1)/2;
        sum+=a;
        S[i]=sum
    }
    max = 0
    for(i=1;i<=N-K;i++){
        a=S[i+K]-S[i]
        max = a > max ? a : max
    }
    printf"%.7f\n",max
}'