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

tmp_list = []

for i in range(n):
    tmp = A[i]
    now = tmp
    while True:
        if tmp != 0:
            tmp = tmp // (2)
            tmp_list.append(now - tmp)
            now = tmp
        else:
            break

tmp_list.sort(reverse=True)
print(sum(A) - sum(tmp_list[:m]))  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 tmp_list = [] tmp_list [] for i in range(n):
    tmp = A[i]
    now = tmp
    while True:
        if tmp != 0:
            tmp = tmp // (2)
            tmp_list.append(now - tmp)
            now = tmp
        else:
            break i range(n) range n tmp = A[i] tmp A[i] A i now = tmp now tmp while True:
        if tmp != 0:
            tmp = tmp // (2)
            tmp_list.append(now - tmp)
            now = tmp
        else:
            break True if tmp != 0:
            tmp = tmp // (2)
            tmp_list.append(now - tmp)
            now = tmp
        else:
            break tmp != 0 tmp 0 tmp = tmp // (2) tmp tmp // (2) tmp 2 tmp_list.append(now - tmp) tmp_list.append tmp_list append now - tmp now tmp now = tmp now tmp break tmp_list.sort(reverse=True) tmp_list.sort tmp_list sort reverse=True reverse True print(sum(A) - sum(tmp_list[:m])) print sum(A) - sum(tmp_list[:m]) sum(A) sum A sum(tmp_list[:m]) sum tmp_list[:m] tmp_list :m m now = tmp tmp now m = map(int, input().split()) map(int, input().split()) m tmp = tmp // (2) tmp // (2) tmp now = tmp tmp now tmp_list = [] [] tmp_list tmp = A[i] A[i] tmp n, m = map(int, input().split()) map(int, input().split()) n A = list(map(int, input().split())) list(map(int, input().split())) A
n, m = map(int, input().split())
A = list(map(int, input().split()))

tmp_list = []

for i in range(n):
    tmp = A[i]
    now = tmp
    while True:
        if tmp != 0:
            tmp = tmp // (2)
            tmp_list.append(now - tmp)
            now = tmp
        else:
            break

tmp_list.sort(reverse=True)
print(sum(A) - sum(tmp_list[:m])) 