module app;

import core.bitop;

import std.algorithm;
import std.array;
import std.bigint;
import std.conv;
import std.stdio;
import std.string;

void main()
{
    Input input = void;
    parseInput(input, stdin);
    auto result = main2(&input);
    writeln(result);
}

auto main2(Input* input)
{
	auto sorted = input.a.sort!("a>b").array;
	foreach (i; 0..input.m)
	{
		auto newValue = sorted[0] >> 1;

		if (sorted.length == 1)
		{
			sorted[0] = newValue;
			continue;
		}

		size_t binarySearch(size_t begin, size_t end, size_t value)
		{
			if (begin == end)
				return begin;
			if (end - begin == 1)
			{
				if (value > sorted[begin])
					return begin - 1;
				else
					return begin;
			}

			if (value > sorted[(begin + end) / 2])
				return binarySearch(begin, (begin + end)/2, value);
			else
				return binarySearch((begin + end)/2, end, value);
		}
	
		auto index = binarySearch(1, sorted.length, newValue);

		for (int j = 1; j < index + 1; j++)
			sorted[j-1] = sorted[j];
		sorted[index] = newValue;
	}

    BigInt count = 0;
	foreach (a; sorted)
		count += a;
    return count;
}

unittest { writefln("begin unittest"); }

unittest // example1
{
    string example =
`3 3
2 13 8`;
    Input input = void;
    parseExample(input, example);
    auto result = main2(&input);
    assert(result == 9);
}

unittest // example2
{
    string example =
`4 4
1 9 3 5`;
    Input input = void;
    parseExample(input, example);
    auto result = main2(&input);
    assert(result == 6);
}

unittest // example3
{
    string example =
`1 100000
1000000000`;
    Input input = void;
    parseExample(input, example);
    auto result = main2(&input);
    assert(result == 0);
}

unittest // example4
{
    string example =
`10 1
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000`;
    Input input = void;
    parseExample(input, example);
    auto result = main2(&input);
    assert(result == 9500000000);
}

unittest { writefln("end unittest"); }

struct Input
{
	uint n,m;
    uint[] a;
}

void parseInput(T)(out Input input, T file)
{
    with (file) with (input)
    {
		auto nm = readln().strip().split().map!(a=>a.to!uint).array();
		n = nm[0]; m = nm[1];
        input.a = readln().strip().split().map!(a=>a.to!uint).array();
    }
}

void parseExample(out Input input, string example)
{
    struct Adapter
    {
        import std.string;
        string[] _lines;
        this(string input) { _lines = input.splitLines(); }

        string readln()
        {
            auto line = _lines[0];
            _lines = _lines[1..$];
            return line;
        }
    }
    Adapter a = Adapter(example);
    parseInput(input, a);
}
