unittest
{
	assert( [ "3 3", "2 13 8" ].parse.expand.solve == 9 );
	assert( [ "4 4", "1 9 3 5" ].parse.expand.solve == 6 );
	assert( [ "1 100000", "1000000000" ].parse.expand.solve == 0 );
	assert( [ "10 1", "1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000" ].parse.expand.solve == 9500000000 );
}



import std.algorithm;
import std.conv;
import std.container;
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 nm = input.front.split.to!( long[] );
	input.popFront;
	auto as = input.front.split.to!( long[] );
	return tuple( nm[ 1 ], as );
}

auto solve( long m, long[] as )
{
	auto queue = heapify( as );
	for( ; 0 < m; m-- )
	{
		queue.replaceFront( queue.front >> 1 );
	}
	return as.sum;
}
