from heapq import heappop, heappush

n,m=list(map(int,input().split()))

A=list(map(int,input().split()))

B=sorted([x * -1 for x in A])

for i in range(m):

    a=heappop(B)

    a=-(-a//2)

    heappush(B,a)

print((-sum(B)))
from heapq import heappop,heappush,heapify

n,m=list(map(int,input().split()))

A=[-i for i in list(map(int,input().split()))]

heapify(A)

for i in range(m):

	a=heappop(A)

	heappush(A,-(-a//2))

print((-sum(A)))
from heapq import heappop, heappush

n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
B = sorted([x * -1 for x in A])
for i in range(m):
    a = heappop(B)
    a = -(-a // 2)
    heappush(B, a)
print((-sum(B)))

from heapq import heappop, heappush, heapify

n, m = list(map(int, input().split()))
A = [-i for i in list(map(int, input().split()))]
heapify(A)
for i in range(m):
    a = heappop(A)
    heappush(A, -(-a // 2))
print((-sum(A)))

-from heapq import heappop, heappush +from heapq import heappop, heappush, heapify -A = list(map(int, input().split())) -B = sorted([x * -1 for x in A]) +A = [-i for i in list(map(int, input().split()))] +heapify(A) -    a = heappop(B) -    a = -(-a // 2) -    heappush(B, a) -print((-sum(B))) +    a = heappop(A) +    heappush(A, -(-a // 2)) +print((-sum(A)))