# coding: utf-8

# Your code here!

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

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



l = []

for i in range(N):

    num = A[i]

    while num > 0:

        l.append(num)

        num = int(num / 2)



l.sort(reverse = True)



s = sum(A)

p = 0



if len(l) >= M:

    for i in range(M):

        p += l[i] - int(l[i] / 2)



    print((s - p))

    

else :

    print((0))
# coding: utf-8

# Your code here!

import heapq

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

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



A = list([x*(-1) for x in A]) #各要素を-1倍

heapq.heapify(A)



for i in range(M):

    tmp_min = heapq.heappop(A)

    heapq.heappush(A,int(tmp_min / 2))

    

print((-sum(A)))
# coding: utf-8
# Your code here!
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
l = []
for i in range(N):
    num = A[i]
    while num > 0:
        l.append(num)
        num = int(num / 2)
l.sort(reverse=True)
s = sum(A)
p = 0
if len(l) >= M:
    for i in range(M):
        p += l[i] - int(l[i] / 2)
    print((s - p))
else:
    print((0))

# coding: utf-8
# Your code here!
import heapq

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A = list([x * (-1) for x in A])  # 各要素を-1倍
heapq.heapify(A)
for i in range(M):
    tmp_min = heapq.heappop(A)
    heapq.heappush(A, int(tmp_min / 2))
print((-sum(A)))

+import heapq + -l = [] -for i in range(N): -    num = A[i] -    while num > 0: -        l.append(num) -        num = int(num / 2) -l.sort(reverse=True) -s = sum(A) -p = 0 -if len(l) >= M: -    for i in range(M): -        p += l[i] - int(l[i] / 2) -    print((s - p)) -else: -    print((0)) +A = list([x * (-1) for x in A])  # 各要素を-1倍 +heapq.heapify(A) +for i in range(M): +    tmp_min = heapq.heappop(A) +    heapq.heappush(A, int(tmp_min / 2)) +print((-sum(A)))