CodeEff/ECCO huggingface dataset:
# Original solution
import heapq
N,M=list(map(int,input().split()))
a=list(map(int,input().split()))
heapq.heapify(a)
for _ in range(M):
    a = list([x * (-1) for x in a])  # 各要素を-1倍
    heapq.heapify(a)  # リストを優先度付きキューへ
    number=heapq.heappop(a) * (-1) # 最大値の取り出し
    a = list([x * (-1) for x in a])  # 各要素を-1倍
    heapq.heappush(a, number//2)  # 要素の挿入
print((sum(a)))


# Optimized solution
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 _ in range(M):
    number=heapq.heappop(a)  # 最大値の取り出し
    if number%2==0:
        number=number//2
    else:
        number=number//2+1
    heapq.heappush(a, number)  # 要素の挿入
print((-sum(a)))
# Original solution
N,M = list(map(int,input().split()))
value = list(map(int,input().split()))

for _ in range(M):
  value[value.index(max(value))] = max(value)//2
  
print((sum(value)))

# Optimized solution
import heapq as hp
n, m = list(map(int, input().split()))
list_A = list(map(int, input().split()))
 
a_q = []
for i in list_A:
    hp.heappush(a_q, -1*i)
    
for i in range(m):
    tmp = hp.heappop(a_q)
    tmp = hp.heappush(a_q, int(tmp/2))
    
print((-sum(a_q)))
# Original solution
import heapq

N,M = list(map(int,input().split()))
original_value = list(map(int,input().split()))
value = []

for v in original_value:
  heapq.heappush(value,v*(-1))

for i in range(M):
  num = (heapq.heappop(value)*(-1)//2)*(-1)
  heapq.heappush(value,num)

print((sum(list([x*(-1) for x in value]))))


# Optimized solution
import heapq

N,M = list(map(int,input().split()))
value = list(map(int,input().split()))
value = list([x*(-1) for x in value])
heapq.heapify(value)

for i in range(M):
  num = (heapq.heappop(value)*(-1)//2)*(-1)
  heapq.heappush(value,num)

print((sum(list([x*(-1) for x in value]))))
# Original solution
N, M = list(map(int, input().split()))
A = [int(a) for a in input().split()]
A = sorted(A)
for _ in range(M):
    A[-1] = int(A[-1] * 0.5)
    A = sorted(A)
print((sum(A)))

# Optimized solution
import heapq

N, M = list(map(int, input().split()))
A = [int(a) for a in input().split()]
q = []
for a in A:
    heapq.heappush(q, -a)
    
for _ in range(M):
    tmp = -heapq.heappop(q)
    heapq.heappush(q, -(tmp//2))
print((-sum(q)))
# Original solution
import heapq
import sys
input = sys.stdin.readline

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

for _ in range(m):
    maximum = a.index(max(a))
    a[maximum] = a[maximum] // 2

print((sum(a)))


# Optimized solution
from heapq import heappop,heappush,heapify
import sys
input = sys.stdin.readline

n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a_minus = [-x for x in a]
heapify(a_minus)

pop = lambda: -heappop(a_minus)
push = lambda x: heappush(a_minus,-x)

for _ in range(m):
    x = pop()
    push(x//2)

print((-sum(a_minus)))
# Original solution
N, M = list(map(int, input().split()))

A = list([int(x) for x in input().split(' ')])
A.sort(reverse=True)

for _ in range(M):
    A[0] = A[0] // 2
    for i in range(N-1):
        if A[i] < A[i+1]:
            A[i+1], A[i] = A[i:i+2]
        else:
            break

print(('{}'.format(sum(A))))

# Optimized solution
import heapq
 
N, M = list(map(int, input().split()))
A = input().split(" ")
neg_A = [-int(a) for a in A]
 
heapq.heapify(neg_A)
 
for t in range(M):
    heapq.heappush(neg_A, -(-heapq.heappop(neg_A)//2))
print((-sum(neg_A)))
# Original solution
import bisect

n, m=list(map(int, input().split()))
a=[int(n) for n in input().split()]
ans=0
cha=[]
a.sort()
if len(a)>m:
  for i in range(m):
    cha.append(a.pop())
else:
  for i in range(len(a)):
    cha.append(a.pop())
cha.sort()
for i in range(m):
  num=cha.pop()//2
  cha.insert(bisect.bisect_left(cha,num),num)


print((sum(cha)+sum(a)))

# Optimized solution
import heapq

n, m=list(map(int, input().split()))
a=[-1*int(n) for n in input().split()]
heapq.heapify(a)

for i in range(m):
  num=-1*(-1*heapq.heappop(a)//2)
  heapq.heappush(a,num)

print((-1*sum(a)))
# Original solution
n, m = list(map(int,input().split()))
s = list(map(int, input().split()))
for i in range(m):
    idx = s.index(max(s))
    s[idx] = max(s)//2
print((sum(s)))

# Optimized solution
import heapq

n, m = list(map(int,input().split()))
s = list(map(int, input().split()))
s = list([x * (-1) for x in s])
heapq.heapify(s)

for i in range(m):
    mx = heapq.heappop(s) * (-1)
    mx = mx//2
    heapq.heappush(s, mx*(-1))
    
print((sum(s)*(-1)))
# Original solution
import bisect
import sys
input = sys.stdin.readline

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

for _ in range(m):
    max_price = A.pop(-1) // 2
    bisect.insort(A, max_price)

total = sum(A)
print(total)


# Optimized solution
import heapq
import sys
input = sys.stdin.readline

n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
A = list([x*(-1) for x in A])
heapq.heapify(A)

for _ in range(m):
    max_price = -heapq.heappop(A) // 2
    heapq.heappush(A, -max_price)

total = -sum(A)
print(total)
# Original solution
n,m = list(map(int,input().split()))
a_L = list(map(int,input().split()))

#a_L = list(sorted(a_L))
#max_num = a_L[0]
#a_L.append(max_num)

for val in range(0,m):
    a_L = list(sorted(a_L))
    a_L[-1] = a_L[-1] //2

print((sum(a_L)))



# Optimized solution
import heapq

n,m = list(map(int,input().split()))
a_L = list([int(x) * -1 for x in input().split()])

heapq.heapify(a_L)
#a_L = list(sorted(a_L))
#max_num = a_L[0]
#a_L.append(max_num)

for val in range(0,m):
    a_min = heapq.heappop(a_L)
    a_min = (-1 * a_min)//2 * -1
    heapq.heappush(a_L,a_min)

print((-sum(a_L)))
# Original solution
import bisect 
n,m = list(map(int,input().split()))
a = sorted(list(map(int,input().split())))
 
for i in range(m):
  b = a[-1]
  a.remove(b)
  b = int(b/2)
  bisect.insort(a,b)
  
print((sum(a)))

# Optimized solution
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 = heapq.heappop(a)
  heapq.heappush(a,(-tmp//2)*(-1))#負の剰余では切り捨て方向が異なってしまうので，いったんプラスにする．
  
print((-sum(a)))
# Original solution
N, M = list(map(int,input().split()))

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

import heapq
def min_heapsort(iter):
    h = []
    for value in iter:
        heapq.heappush(h, value)
    return [heapq.heappop(h) for i in range(len(h))]

def max_heapsort(iter):
    for i in reversed(list(range(len(iter)//2))):
        max_heapify(iter,i)

def max_heapify(array,i):
    left = 2*i+1
    right = 2*i+2
    length = len(array) - 1
    biggest = i

    if left <= length and array[i] < array[left]:
        biggest = left
    if right <= length and array[biggest] < array[right]:
        biggest = right
    if biggest != i:
        array[i], array[biggest] = array[biggest], array[i]
        max_heapify(array, biggest)

def waribiki(X,Y):
    return X//(2**Y)

if len(A)==1:
    while M>0:
        A[0] = waribiki(A[0],1)
        M -= 1
else:
    while M>0:
        #A.sort(reverse=True)
        max_heapsort(A)
        
        m=1
        #while M>0 and waribiki(A[0],m)>A[1]:
        #    m+=1
        A[0] = waribiki(A[0],m)
        M -= m
       

print((sum(A)))


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

def intm(x):
    return int(x)*-1
A = list(map(intm, input().split()))

import heapq

heapq.heapify(A)
while M>0:
    a = -heapq.heappop(A) // 2
    heapq.heappush(A,-a)
    M -= 1
   

print((-sum(A)))
# Original solution
from heapq import heapify, heappush, heappop

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

PQ = [-A for A in As]
heapify(PQ)

for _ in range(M):
    A = -heappop(PQ)
    heappush(PQ, -A/2)

ans = 0
while PQ:
    A = -heappop(PQ)
    ans += int(A)

print(ans)


# Optimized solution
from heapq import heapify, heappush, heappop

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

PQ = [-A for A in As]
heapify(PQ)

for _ in range(M):
    A = -heappop(PQ)
    heappush(PQ, -(A//2))

#print('PQ:', PQ)

print((-sum(PQ)))
# Original solution
X = list(map(int, input().split()))
A = list(map(int, input().split()))
for i in range(X[1]):
  A[A.index(max(A))] = int(max(A)/2)
sum = 0
for a in A:
  sum+=a
print(sum)

# Optimized solution
import heapq
X = list(map(int, input().split()))
# A = list(map(int, input().split()))
A = list([int(x)*(-1) for x in input().split()]) # 最大値を取るために各要素を-1倍
heapq.heapify(A)

for i in range(X[1]):
  x = heapq.heappop(A) * (-1) # 最大値の取り出し
  heapq.heappush(A, int(x/2) * (-1))

ans = 0
for i in range(X[0]):
  ans -= A[i]

print(ans)
# Original solution
import sys
input = sys.stdin.readline
N,M = list(map(int, input().split()))
A = list(map(int, input().split()))

for i in range(M):
  index = A.index(max(A))
  A[index] = A[index]//2

print((sum(A)))


# Optimized solution
import sys
from heapq import heappush, heappop
input = sys.stdin.readline
N,M = list(map(int, input().split()))
A = []
for a in input().split():
  heappush(A,-int(a))

for _ in range(M):
  tmp = heappop(A)
  heappush(A, -(-tmp//2))

print((-sum(A)))
# Original solution
n, m = list(map(int, input().split()))

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

a.sort(reverse=True)

if n > 1:
    f = True
else:
    f = False

for i in range(m):
    a[a.index(max(a))] //= 2

print((sum(a)))


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

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

a.sort(reverse=True)

a.append(0)
b = 0

if n > 1:
    for i in range(m):
        a[b] //= 2

        if a[b] < a[0] or a[b] < a[b + 1]:
            if a[0] > a[b + 1]:
                b = 0
                a.sort(reverse=True)
            else:
                b += 1

else:
    for i in range(m):
        a[0] //= 2





print((sum(a)))
# Original solution
n, m = list(map(int, input().split()))
aa = list(map(int, input().split()))

from queue import PriorityQueue

q = PriorityQueue()
for a in aa:
    q.put(-a)
for i in range(m):
    g = q.get()
    q.put(-(-g // 2))
cost = 0
for a in aa:
    cost -=q.get()
print(cost)

# Optimized solution
n, m = list(map(int, input().split()))
aa = list(map(int, input().split()))
import heapq

for i in range(len(aa)):
    aa[i] = -aa[i]
heapq.heapify(aa)

for i in range(m):
    v = heapq.heappop(aa)
    heapq.heappush(aa,-(-v // 2))
cost = 0
for i in range(len(aa)):
    cost -=heapq.heappop(aa)
print(cost)
# Original solution
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
for m in range(M):
    A[0] = A[0] // 2
    for i in range(N - 1):
        if A[i] < A[i + 1]:
            A[i], A[i + 1] = A[i + 1], A[i]
        else:
            break
print((sum(A)))

# Optimized solution
def funcD():
    import heapq
    N, M = list(map(int, input().split()))
    A = list([-1 * int(x) for x in input().split()])
    A.sort(reverse=True)
    heapq.heapify(A)
    for m in range(M):
        a = -(-heapq.heappop(A) // 2)
        heapq.heappush(A, a)
    print((-sum(A)))


funcD()
# Original solution
import heapq
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
A=[-A[i] for i in range(N)]
heapq.heapify(A)
for i in range(M):
    a=A[0]
    heapq.heappop(A)
    heapq.heappush(A,-(a//-2))
    heapq.heapify(A)
print((-sum(A)))

# Optimized solution
import heapq
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
A=[-A[i] for i in range(N)]
heapq.heapify(A)
for i in range(M):
    a=A[0]
    heapq.heappop(A)
    heapq.heappush(A,-(a//-2))
print((-sum(A)))
# Original solution
import bisect
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
A.sort()
for i in range(M):
  B = A[-1]//2
  del A[-1]
  bisect.insort_left(A, B)
  #print(A)
print((sum(A)))

# Optimized solution
import heapq
N,M=list(map(int,input().split()))
A=list([int(x)*(-1) for x in input().split()])
heapq.heapify(A) #落としたりするのもO(N)かかってしまうのでHeapで実装
#A=[i for i in range(N)]
for i in range(M):
  B = heapq.heappop(A)
  heapq.heappush(A,-1*(-1*B//2))
  #print(A)
print((-sum(A)))
# Original solution
from bisect import bisect_left
import sys

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

if N == 1:
    for i in range(M):
        A[0] = A[0] // 2
    print((sum(A)))
    sys.exit()

A.sort(reverse=True)
for i in range(M):
    index = A.index(max(A))
    A[index] = A[index] // 2

print((sum(A)))

# Optimized solution
import heapq
import sys

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

if N == 1:
    for i in range(M):
        A[0] = A[0] // 2
    print((sum(A)))
    sys.exit()
h = []
for i in range(N):
    heapq.heappush(h, -A[i])

for i in range(M):
    tmp = heapq.heappop(h)
    tmp = -(-tmp // 2)
    heapq.heappush(h, tmp)


print((-sum(h)))
# Original solution
import bisect

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

for i in range(M):
    t=A[-1]//2
    index=bisect.bisect_right(A,t)
    A=A[0:len(A)-1]
    A.insert(index,t)
    

print((sum(A)))

# Optimized solution
import heapq

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

que = []
for a in A:
  heapq.heappush(que, -1*a)
 
for a in range(M):
  maxvalue = -1 * heapq.heappop(que)
  maxvalue /= 2
  heapq.heappush(que, -1*maxvalue)
 
print((sum([int(-1*a) for a in que])))
# Original solution
from heapq import heappush,heappop,heapify
from math import ceil
def main():
    N, M = (int(i) for i in input().split())
    A = [-int(i) for i in input().split()]
    heapify(A)
    for divcnt in range(M):
        tmp = ceil(heappop(A)/2)
        heappush(A,tmp)
    print((-sum(A)))
if __name__ == "__main__":
    main()


# Optimized solution
def main():
    from heapq import heappush,heappop,heapify
    N, M = (int(i) for i in input().split())
    A = [-int(i) for i in input().split()]
    heapify(A)
    for divcnt in range(M):
        tmp = -heappop(A)
        tmp //= 2
        heappush(A,-tmp)
    print((-sum(A)))
if __name__ == "__main__":
    main()
# Original solution
import bisect

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

A = list(map(int, input().split()))
A.sort()
#print(A)

for _ in range(M):
    a = int(A.pop()/2)
    bisect.insort_left(A, a)

print((sum(A)))

# Optimized solution
import heapq #今回は優先度キューを使う

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

A = list([-int(x) for x in input().split()]) #優先度付きキューは最小値しか出せないので、×-1して最大値を最小値にしている
#A.sort() 今回は間に合わない
heapq.heapify(A) #優先度付きキューに変換
#print(A)

for _ in range(M):
    a = heapq.heappop(A) #最小値取得
    a = -a // 2 #負のまま計算すると切り捨てが違うところで起こる
    heapq.heappush(A,-a) #優先度付きキューに挿入

print((-sum(A)))
# Original solution
import sys

def main():
	input = sys.stdin.readline

	N, M = list(map(int,input().strip().split()))
	A = list(map(int,input().strip().split()))
	A.sort(reverse=True)

	for i in range(M):
		A[0] = A[0]/2

		larger = -1
		smaller = N-1
		target = A.pop(0)
		while larger-smaller!=-1:
			ind = int((larger+smaller)/2)
			if target>A[ind]:
				smaller = ind
			else:
				larger = ind

		A.insert(smaller,target)
		# print(A)

		# ind = 0
		# if N!=1:
		# 	while A[ind]<A[ind+1]:
		# 		A[ind], A[ind+1] = A[ind+1], A[ind]
		# 		ind = ind+1
		# 		if ind==N-1:
		# 			break

	print((sum(map(int,A))))

if __name__ == "__main__":
    main()

# Optimized solution
import sys

def main():
	input = sys.stdin.readline

	N, M = list(map(int,input().strip().split()))
	A = list(map(int,input().strip().split()))
	A.sort(reverse=True)

	count = [0]*N
	ind = [0]
	for i in range(M):
		maximum = 0
		for j in ind:
			if A[j]>maximum:
				maxind = j
				maximum = A[j]

		if maximum==0: break

		# print(maxind)
		A[maxind] = A[maxind]/2
		count[maxind] += 1
		# print(count[maxind])
		if count[maxind]==len(ind):
			ind.append(0)
			# ind[-2] += 1
			ind[-2] = min(N-1,ind[-2]+1)
			# if ind[-1]!=N-1:
		else: 
			# ind[count[maxind]-1] += 1
			ind[count[maxind]-1] = min(N-1,ind[count[maxind]-1]+1)

		# print(ind)

	print((sum(map(int,A))))

if __name__ == "__main__":
    main()
# Original solution
import math

N, M = list(map(int, input().split()))
price = list(map(int, input().split()))
total = sum(price)
for i in range(M):
    max_index = price.index(max(price))
    discount = math.ceil(max(price) / 2)
    total -= discount
    price[max_index] -= discount
print(total)

# Optimized solution
import heapq

N, M = list(map(int, input().split()))
price = list([int(x) * (-1) for x in input().split()])

heapq.heapify(price)

for i in range(M):
    max_price = -(heapq.heappop(price))
    new_price = max_price // 2
    heapq.heappush(price, -(max_price // 2))

print((-(sum(price))))
# Original solution
import heapq
N, M = list(map(int, input().split()))
a = list([int(x)*(-1) for x in input().split()])
heapq.heapify(a)
for i in range(M):
    tmp = heapq.heappop(a)
    if tmp % 2 == 0:
        tmp //= 2
    else:
        tmp //= 2
        tmp += 1
    heapq.heappush(a,tmp)
print((sum(a)*(-1)))

# Optimized solution
N, M = list(map(int, input().split()))
arr = list([int(x)*(-1) for x in input().split()])
import heapq
heapq.heapify(arr)
for _ in range(M):
    tmp = heapq.heappop(arr)
    heapq.heappush(arr,-(-tmp//2))
print((-sum(arr)))
# Original solution
def main():
    N,M=list(map( int, input().split()))
    A=list( map( int, input().split()))
    for i in range(M):
        A[A.index(max(A))] = A[A.index(max(A))]//2
    print((sum(A)))

if __name__ == '__main__':
    main()

# Optimized solution
import heapq
def main():
    N,M=list(map( int, input().split()))
    A=list( map( int, input().split()))
    A = list([x*(-1) for x in A])
    heapq.heapify(A)
    for _ in range(M):
        u = heapq.heappop(A)
        heapq.heappush(A,int(u/2))
    print((-sum(A)))


    

if __name__ == '__main__':
    main()
# Original solution
import math
n, m = list(map(int, input().split(" ")))
a = list(map(int, input().split(" ")))

for i in range(m):
    max = 0
    for j in range(n):
        if a[j] > max:
            max = a[j]
            maxIndex = j
    a[maxIndex] /= 2

count = 0
for i in range(n):
    count += math.floor(a[i])

print(count)


# Optimized solution
import math
import heapq

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

a_minus = [a[i] * (-1) for i in range(n)]

heapq.heapify(a_minus)

for i in range(m):
    value = heapq.heappop(a_minus)
    value /= 2
    heapq.heappush(a_minus, value)

count = 0
for i in range(n):
    value = heapq.heappop(a_minus) * -1
    count += math.floor(value)

print(count)
# Original solution
import bisect

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

for i in range(m):
    a = A.pop(-1)
    a //= 2
    bisect.insort_left(A, a)

print((sum(A)))


# Optimized solution
import heapq

n, m = list(map(int, input().split()))
A = sorted(list([int(x)*(-1) for x in input().split()]))

heapq.heapify(A)

for i in range(m):
    a = heapq.heappop(A)
    a = a * (-1) // 2
    heapq.heappush(A, -a)

print((-sum(A)))
# Original solution
N,M = input().split()
N = int(N)
M = int(M)
price_list = input().split()
 
price_list = list(map(int, price_list))
 
for _ in range(M):
  num = max(price_list)
  price_list.remove(num)
  price_list.append(int(num/2))
print((sum(price_list)))

# Optimized solution
import heapq

N,M = input().split()
N = int(N)
M = int(M)
price_list = input().split()
 
heap_list = []
for i in price_list:
  heapq.heappush(heap_list, int(i) * (-1))

for _ in range(M):
  max_num = heapq.heappop(heap_list)
  heapq.heappush(heap_list, int(max_num /2))
  
print((sum(heap_list) * (-1)))
# Original solution
from math import ceil
import heapq

N, M = list(map(int, input().split()))
tmpA = list(map(int, input().split()))
A = [-a for a in tmpA]
heapq.heapify(A)

for _ in range(M):
    a = heapq.heappop(A)
    heapq.heappush(A, ceil(a / 2))

print((-sum(A)))


# Optimized solution
from math import ceil
import heapq

N, M = list(map(int, input().split()))
A = [-int(a) for a in input().split()]
heapq.heapify(A)

for _ in range(M):
    a = heapq.heappop(A)
    heapq.heappush(A, ceil(a / 2))

print((-sum(A)))
# Original solution
import sys
input = sys.stdin.readline

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse = True)
for i in range(M):
    a = A.index(max(A))
    A[a] = int(A[a]/2)

print((sum(A)))

# Optimized solution
import sys
import heapq
input = sys.stdin.readline

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
for i in range(N):
    A[i] = (-1)*A[i]

heapq.heapify(A)

for i in range(M):
    a = heapq.heappop(A)
    heapq.heappush(A, int(a/2))

print((abs(sum(A))))
# Original solution
import bisect
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))

a_sorted = sorted(a)

while m > 0:
    maximum = a_sorted.pop(-1)
    if maximum % 2 == 0:
        bisect.insort_left(a_sorted, maximum//2)
    else:
        bisect.insort_left(a_sorted, maximum//2)
    m += -1
ans = sum(a_sorted)
print(ans)

# Optimized solution
import heapq

n, m = list(map(int, input().split()))
a = list([int(x) * (-1) for x in input().split()])
heapq.heapify(a)

for i in range(m):
    maximum = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-maximum//2))
print((-sum(a)))
# Original solution
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))

for _ in range(M):
  ma=max(A)
  A[A.index(ma)]=ma//2

print((sum(A)))

# Optimized solution
import heapq
N,M=list(map(int,input().split()))
A=list([-int(x) for x in input().split()])
heapq.heapify(A)


for _ in range(M):
  ma=heapq.heappop(A)
  heapq.heappush(A,-((-ma)//2))
  
print((-sum(A)))
# Original solution
import bisect

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

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

for w in range(M):
    max2=A.pop(N-1)/2
    #A[N-1]=A[N-1]/2
    #max=A[N-1]
    
    bisect.insort_left(A,max2)
    #print(A)

B=list(map(int, A))
#print(B)
print((sum(B)))

# Optimized solution
import heapq

N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
#print(A)
A =[-a for a in A]
#print(A)
heapq.heapify(A)

for w in range(M):
    max=heapq.heappop(A)
    heapq.heappush(A,max/2)
   
B=list(map(int, A))
#print(B)
print((sum(B)*-1))
# Original solution
n,m = list(map(int,input().split()))
item = list(map(int,input().split()))
 
item.sort(reverse=True)
s = 0
 
while s == 0:
    for i in range(n):
        if i == 0:
            item[i] = int(item[i]/2)
            m -= 1
            temp = item[i]
            if m == 0:
                s = 1
                break
            continue

        item.sort(reverse=True)
        break
        
 
print((sum(item)))

# Optimized solution
n,m = list(map(int,input().split()))
item = list(map(int,input().split()))

#品物を高い順に並び替える
item.sort(reverse=True)

#割引券がなくなるまで操作を繰り返す
while m != 0:
    
    #品物の高いものから順に割引券を使用していく
    for i in range(n):
        
        #一番高い品物の割引券を使用した後の値段はtempとして保持しておく
        if i == 0:
            item[i] = int(item[i]/2)
            m -= 1
            temp = item[i]
            if m == 0:
                break
            continue
        
        #tempよりも品物の値段が高い間は割引券を使用しながらfor文を回し続ける
        if item[i] > temp:
            item[i] = int(item[i]/2)
            m -= 1
            if m == 0:
                break
            continue
        
        #tempよりも品物の値段が安くなったら、もう一度値段の高い順にソートし直して操作を繰り返す
        item.sort(reverse=True)
        break

#品物の値段を合計して出力        
print((sum(item)))
# Original solution
n, m = list(map(int, input().split()))
items = list(map(int, input().split()))
for i in range(m):
    max_val_i = items.index(max(items))
    items[max_val_i] /= 2
print((sum(list(map(int, items)))))

# Optimized solution
import heapq as hq
n, m = list(map(int, input().split()))
items = [-int(i) for i in input().split()]
hq.heapify(items)
for _ in range(m):
    max_val = hq.heappop(items)
    hq.heappush(items, -(-max_val // 2))
print((-sum(items)))