import heapq



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

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



heapq.heapify(a)

for i in range(m):

 max=-heapq.heappop(a)

 heapq.heappush(a,-1*(max//2))



print((sum([-int(i) for i in a])))
import heapq



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

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



heapq.heapify(a)

for i in range(m):

 max=-heapq.heappop(a)

 heapq.heappush(a,-1*(max//2))



print((-sum(a)))
import heapq

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

import heapq

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

-print((sum([-int(i) for i in a]))) +print((-sum(a)))