import std.algorithm;
import std.bigint;
import std.concurrency;
import std.container;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.meta;
import std.numeric;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.traits;
import std.typecons;


auto solve(long N, long M, long[] A) {
    // discountable, price, used coupons
    alias T = Tuple!(long, long, long);
    auto heap = make!(RedBlackTree!(T, "a > b", true));
    foreach (a; A) {
        heap.insert(tuple((a + 1) / 2, a, 0L));
    }
    
    long asum = A.sum;
    long discount;
    foreach (_; 0 .. M) {
        auto d = heap.front;
        heap.removeFront;
        discount += d[0];

        if (discount >= asum)
            break;

        if (d[2] >= 40)
            heap.insert(tuple(0L, d[1], d[2] + 1));
        else
            heap.insert(tuple(d[1] / 2 ^^ (d[2] + 1) - d[1] / 2 ^^ (d[2] + 2), d[1], d[2] + 1));
    }

    return max(0, asum - discount);
}


void main() {
    auto input = stdin.byLine.map!split.joiner;

    long N;
    N = input.front.to!long;
    input.popFront;

    long M;
    M = input.front.to!long;
    input.popFront;

    long[] A = new long[](cast(size_t) (N));
    foreach (i; 0 .. cast(size_t) (N)) {
        A[i] = input.front.to!long;
        input.popFront;
    }

    static if (is(ReturnType!solve == void))
        solve(N, M, A);
    else
        solve(N, M, A).writeln;
}
