from collections import deque


N, M = map(int, input().split())
A = deque(sorted(list(map(int, input().split()))))
B = deque()

coupon = M
while coupon:
    try:
        if B:
            if A[-1] >= B[-1]:
                B.appendleft(A.pop() // 2)
            else:
                B.appendleft(B.pop() // 2)
        else:
            B.append(A.pop() // 2)
        coupon -= 1
    except IndexError:
        A, B = B, A


ans = sum(int(i) for i in A) + sum(int(i) for i in B)
print(ans) from collections import deque N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M A = deque(sorted(list(map(int, input().split())))) A deque(sorted(list(map(int, input().split())))) deque sorted(list(map(int, input().split()))) sorted list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split B = deque() B deque() deque coupon = M coupon M while coupon:
    try:
        if B:
            if A[-1] >= B[-1]:
                B.appendleft(A.pop() // 2)
            else:
                B.appendleft(B.pop() // 2)
        else:
            B.append(A.pop() // 2)
        coupon -= 1
    except IndexError:
        A, B = B, A coupon try:
        if B:
            if A[-1] >= B[-1]:
                B.appendleft(A.pop() // 2)
            else:
                B.appendleft(B.pop() // 2)
        else:
            B.append(A.pop() // 2)
        coupon -= 1
    except IndexError:
        A, B = B, A except IndexError:
        A, B = B, A A, B = B, A A B B A if B:
            if A[-1] >= B[-1]:
                B.appendleft(A.pop() // 2)
            else:
                B.appendleft(B.pop() // 2)
        else:
            B.append(A.pop() // 2)
         B if A[-1] >= B[-1]:
                B.appendleft(A.pop() // 2)
            else:
                B.appendleft(B.pop() // 2)
         A[-1] >= B[-1] A[-1] A -1 B[-1] B -1 B.appendleft(A.pop() // 2) B.appendleft B appendleft A.pop() // 2 A.pop() A.pop A pop 2 B.appendleft(B.pop() // 2) B.appendleft B appendleft B.pop() // 2 B.pop() B.pop B pop 2 B.append(A.pop() // 2) B.append B append A.pop() // 2 A.pop() A.pop A pop 2 coupon -= 1 coupon 1 ans = sum(int(i) for i in A) + sum(int(i) for i in B) ans sum(int(i) for i in A) + sum(int(i) for i in B) sum(int(i) for i in A) sum int(i) int i sum(int(i) for i in B) sum int(i) int i print(ans) print ans N, M = map(int, input().split()) map(int, input().split()) N M = map(int, input().split()) map(int, input().split()) M B = deque() deque() B coupon -= 1 1 coupon A, B = B, A B A A = deque(sorted(list(map(int, input().split())))) deque(sorted(list(map(int, input().split())))) A B = B, A A B coupon = M M coupon ans = sum(int(i) for i in A) + sum(int(i) for i in B) sum(int(i) for i in A) + sum(int(i) for i in B) ans
from collections import deque


N, M = map(int, input().split())
A = deque(sorted(list(map(int, input().split()))))
B = deque()

coupon = M
while coupon:
    try:
        if B:
            if A[-1] >= B[-1]:
                B.appendleft(A.pop() // 2)
            else:
                B.appendleft(B.pop() // 2)
        else:
            B.append(A.pop() // 2)
        coupon -= 1
    except IndexError:
        A, B = B, A


ans = sum(int(i) for i in A) + sum(int(i) for i in B)
print(ans)
