from heapq import heapify, heappop, heappush
N, M = map(int, input().split())
A = list(map(int, input().split()))
q = []
for a in A:
    q.append((a//2-a, a, 1))
heapify(q)
ans = sum(A)
for _ in range(M):
    discount, a, n = heappop(q)
    ans += discount
    if ans==0:
        break
    heappush(q, (a//2**(n+1)-a//2**n, a, n+1))
print(ans) from heapq import heapify, heappop, heappush N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M A = list(map(int, input().split())) A list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split q = [] q [] for a in A:
    q.append((a//2-a, a, 1)) a A q.append((a//2-a, a, 1)) q.append q append (a//2-a, a, 1) a//2-a a//2 a 2 a a 1 heapify(q) heapify q ans = sum(A) ans sum(A) sum A for _ in range(M):
    discount, a, n = heappop(q)
    ans += discount
    if ans==0:
        break
    heappush(q, (a//2**(n+1)-a//2**n, a, n+1)) _ range(M) range M discount, a, n = heappop(q) discount heappop(q) heappop q a n ans += discount ans discount if ans==0:
        break
     ans==0 ans 0 break heappush(q, (a//2**(n+1)-a//2**n, a, n+1)) heappush q (a//2**(n+1)-a//2**n, a, n+1) a//2**(n+1)-a//2**n a//2**(n+1) a 2**(n+1) 2 n+1 n 1 a//2**n a 2**n 2 n a n+1 n 1 print(ans) print ans N, M = map(int, input().split()) map(int, input().split()) N A = list(map(int, input().split())) list(map(int, input().split())) A ans = sum(A) sum(A) ans ans += discount discount ans a, n = heappop(q) heappop(q) a M = map(int, input().split()) map(int, input().split()) M q = [] [] q discount, a, n = heappop(q) heappop(q) discount n = heappop(q) heappop(q) n
from heapq import heapify, heappop, heappush
N, M = map(int, input().split())
A = list(map(int, input().split()))
q = []
for a in A:
    q.append((a//2-a, a, 1))
heapify(q)
ans = sum(A)
for _ in range(M):
    discount, a, n = heappop(q)
    ans += discount
    if ans==0:
        break
    heappush(q, (a//2**(n+1)-a//2**n, a, n+1))
print(ans)
