unittest
{
	assert( [ "5 3", "1 2 2 4 5" ].parse.expand.solve == "7.000000" );
	assert( [ "4 1", "6 6 6 6" ].parse.expand.solve == "3.500000" );
	assert( [ "10 4", "17 13 13 12 15 20 10 13 17 11" ].parse.expand.solve == "32.000000" );
}



import std.algorithm;
import std.conv;
import std.format;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nk = input.front.split.to!( long[] );
	input.popFront;
	auto ps = input.front.split.to!( long[] );
	return tuple( nk[ 1 ], ps );
}

auto solve( long k, long[] ps )
{
	// 最初のk個の期待値を計算
	auto e = 0.0L;
	foreach( p; ps[ 0 .. k ] )
	{
		e += ( 1 + p ) / 2.0L;
	}
	
	// 一つずつずらしながら期待値の最大を検索
	auto ans = e;
	foreach( i; k .. ps.length.signed )
	{
		auto ep = ( 1 + ps[ i ] ) / 2.0L;
		auto em = ( 1 + ps[ i - k ] ) / 2.0L;
		e += ep - em;
		ans = max( ans, e );
	}
	return format( "%0.6f", ans );
}
