# -*- coding: utf-8 -*-

from heapq import heappop, heappush, heapify

import sys

#input = sys.stdin.readline

def inpl(): return list(map(int, input().split()))



N, M = inpl()

A = inpl()

Q = [[-A[i], A[i], 0] for i in range(N)]

F = 2

heapify(Q)



for _ in range(M):

    b, a, x = heappop(Q)

    if b:

        b = a//(2**(x+1))

    heappush(Q, [-b, a, x+1])



ans = 0

for i in range(N):

    ans -= Q[i][0]



print(ans)
from heapq import heappop, heappush

def inpl(): return list(map(int, input().split()))

N, M = inpl()

A = inpl()

Q = []

for a in A:

    heappush(Q, [-a, a, 0])



for i in range(M):

    x, a, d = heappop(Q)

    if x == 0:

        break

    heappush(Q, [-(a//pow(2, d+1)), a, d+1])



print((sum([-q[0] for q in Q])))
# -*- coding: utf-8 -*-
from heapq import heappop, heappush, heapify
import sys

# input = sys.stdin.readline
def inpl():
    return list(map(int, input().split()))


N, M = inpl()
A = inpl()
Q = [[-A[i], A[i], 0] for i in range(N)]
F = 2
heapify(Q)
for _ in range(M):
    b, a, x = heappop(Q)
    if b:
        b = a // (2 ** (x + 1))
    heappush(Q, [-b, a, x + 1])
ans = 0
for i in range(N):
    ans -= Q[i][0]
print(ans)

from heapq import heappop, heappush


def inpl():
    return list(map(int, input().split()))


N, M = inpl()
A = inpl()
Q = []
for a in A:
    heappush(Q, [-a, a, 0])
for i in range(M):
    x, a, d = heappop(Q)
    if x == 0:
        break
    heappush(Q, [-(a // pow(2, d + 1)), a, d + 1])
print((sum([-q[0] for q in Q])))

-# -*- coding: utf-8 -*- -from heapq import heappop, heappush, heapify -import sys +from heapq import heappop, heappush -# input = sys.stdin.readline + -Q = [[-A[i], A[i], 0] for i in range(N)] -F = 2 -heapify(Q) -for _ in range(M): -    b, a, x = heappop(Q) -    if b: -        b = a // (2 ** (x + 1)) -    heappush(Q, [-b, a, x + 1]) -ans = 0 -for i in range(N): -    ans -= Q[i][0] -print(ans) +Q = [] +for a in A: +    heappush(Q, [-a, a, 0]) +for i in range(M): +    x, a, d = heappop(Q) +    if x == 0: +        break +    heappush(Q, [-(a // pow(2, d + 1)), a, d + 1]) +print((sum([-q[0] for q in Q])))