from heapq import heappush, heappop, heapify

N, M = list(map(int, input().split()))

a = [-int(a) for a in input().split()]

heapify(a)

for _ in range(M):

  heappush(a, heappop(a) / 2)

print((-sum(int(x) for x in a)))

from heapq import heappush, heappop, heapify

N, M = list(map(int, input().split()))

a = [-int(a) for a in input().split()]

heapify(a)

for _ in range(M):

  heappush(a, heappop(a) / 2)

print((sum(int(-x) for x in a)))

from heapq import heappush, heappop, heapify

N, M = list(map(int, input().split()))
a = [-int(a) for a in input().split()]
heapify(a)
for _ in range(M):
    heappush(a, heappop(a) / 2)
print((-sum(int(x) for x in a)))

from heapq import heappush, heappop, heapify

N, M = list(map(int, input().split()))
a = [-int(a) for a in input().split()]
heapify(a)
for _ in range(M):
    heappush(a, heappop(a) / 2)
print((sum(int(-x) for x in a)))

-print((-sum(int(x) for x in a))) +print((sum(int(-x) for x in a)))