CodeEff/ECCO huggingface dataset:
# Original solution
import heapq
from collections import deque
n,m=list(map(int,input().split()))
A=list(map(int,input().split()))
#print(A)
for i in range(n):
    A[i]*=-1
#print(A)

for i in range(m):
    heapq.heapify(A)
    x=heapq.heappop(A)
    #print(x,A)
    if x%2==0:
        x//=2
    else:
        x=x//2 +1
    heapq.heappush(A,x)
    #print(A)
ans=-1*sum(A)
print(ans)

# Optimized solution
import heapq
from collections import deque
n,m=list(map(int,input().split()))
A=list(map(int,input().split()))

for i in range(n):
    A[i]*=-1
heapq.heapify(A)

for i in range(m):
    x=heapq.heappop(A)
    if x%2==0:
        x//=2
    else:
        x=x//2 +1
    heapq.heappush(A,x)

ans=-1*sum(A)
print(ans)
# Original solution
N,M = list(map(int, input().split()))
A = list(map(int, input().split()))
A = sorted(A)
while M > 0:
    A[-1] = A[-1] // 2
    M -= 1
    A = sorted(A)
print((sum(A)))

# Optimized solution
N,M = list(map(int, input().split()))
A = list(map(int, input().split()))
for i in range(N):
    A[i] *= -1
import heapq
heapq.heapify(A)
for i in range(M):
    m = heapq.heappop(A)
    heapq.heappush(A,-1*(-m//2))
print((-1*sum(A)))
# Original solution
n,m = list(map(int,input().split()))
As = list(map(int,input().split()))
for i in range(m):
  a = max(As)
  As[As.index(a)] = int(a/2)
print((sum(As)))
  




# Optimized solution
import heapq

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

while M > 0:
    maxv = max(A)
    max_index = A.index(maxv)
    A[max_index] = A[max_index] // 2
    M -= 1

print((sum(A)))


# Optimized solution
import heapq


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

A = [a * -1 for a in A]

heapq.heapify(A)
for _ in range(M):
    a = heapq.heappop(A)
    heapq.heappush(A, (-a // 2) * (-1))

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

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

i=m
while i>0:
    ma=max(c)
    ind=c.index(ma)
    c[ind]=ma//2
    
    i-=1
    
print((sum(c)))

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

c=list([int(x)*-1 for x in input().split()])
#heapqでは最小値しか取り出せないので最大値をとるばあには－１をかけておく

heapq.heapify(c)  #リストを優先度付きキューに
for i in range(m):
    cmin=heapq.heappop(c)  #最小値の取り出し
    heapq.heappush(c,(-1)*(-cmin//2))#最小値を2で割った商をリストに追加

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

for i in range(m):
    maxIndex = 0
    for j in range(n):
        if a[maxIndex] < a[j]:
            maxIndex = j
    a[maxIndex] = a[maxIndex] >> 1
print((sum(a)))

# Optimized solution
import heapq
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(n):
    a[i] *= -1
heapq.heapify(a)
for _ in range(m):
    x = heapq.heappop(a)
    heapq.heappush(a, (-x//2)*(-1))    
 
print((-sum(a)))
# Original solution
from collections import deque

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

A = deque(A)
A = sorted(A)

for i in range(M):
    temp1 = A.index(max(A))
    temp2 = A.pop(temp1) // 2
    A.append(temp2)

print((sum(A)))

# Optimized solution
from heapq import heappop,heappush

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

H = []

for i in A:
    heappush(H, -i)

for _ in range(M):
    heappush(H, -((-heappop(H)//2)) )

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

for _ in range(M):
    A.sort(reverse=True)
    A[0] //= 2

print((sum(A)))


# Optimized solution
import sys
from heapq import heappush, heappop
def input(): return sys.stdin.readline().strip()

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

for _ in range(M):
    val = heappop(A)
    if val == 0:
        break
    heappush(A, (val+1)//2)

print((-1 * sum(A)))
# Original solution
import bisect
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))

while M:
  m = A.index(max(A))
  A[m] //= 2
  M -= 1
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)

while M:
  m = heapq.heappop(A) * (-1)
  heapq.heappush(A, (-1) * (m // 2))
  M -= 1
print((sum(A) * (-1)))
# Original solution
N,M = list(map(int, input().split()))
A = list(map(int, input().split()))
for i in range(M):
    max_A = max(A)
    num_A= A.index(max_A)
    A[num_A] = max_A // 2

print((sum(A)))



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

hq.heapify(A)
for i in range(M):
    m = A[0]
    hq.heappushpop(A, -((-m)//2))
print((-sum(A)))
# Original solution
n,m=list(map(int,input().split()))
a=list(map(int, input().split()))
while m:
	i = a.index(max(a))
	a[i]//=2
	m -= 1
print((sum(a)))

# Optimized solution
import heapq

n, m = list(map(int, input().split()))
lis = []

for i in input().split():
  heapq.heappush(lis, -int(i))

for j in range(m):
  tmp = -heapq.heappop(lis)
  heapq.heappush(lis, -int((tmp/2)))

print((-sum(lis)))
# Original solution
N, M = list(map(int,input().split()))
A = sorted(list(map(int,input().split())), reverse=True)
B = []

B.append(A.pop(0)//2)
for i in range(1,M):
    if A == []:
        B[0] = B[0]//2
        B = sorted(B, reverse=True)
    else:
        if A[0] > B[0]:
            B.append(A.pop(0)//2)
        else:
            B[0] = B[0]//2
            B = sorted(B, reverse=True)

print((sum(A)+sum(B)))

# Optimized solution
N, M = list(map(int,input().split()))
A = sorted(list(map(int,input().split())), reverse=True)
b = []

b.append(A.pop(0)//2)
for i in range(1,M):
    if A == []:
        b.append(b.pop(0)//2)
    else:
        if A[0] > b[0]:
            b.append(A.pop(0)//2)
        else:
            b.append(b.pop(0)//2)

print((sum(A)+sum(b)))
# Original solution
n,m = list(map(int,input().split()))
alist = list(map(int,input().split()))
for i in range(m):
  alist[alist.index(max(alist))] //= 2
print((sum(alist)))

# Optimized solution
import sys
input = sys.stdin.buffer.readline
from math import log

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

table = [[0]*(int(log(a[-1],2))+2) for i in range(n)]

for i in range(n):
    for y in range(int(log(a[-1],2))+2):
        table[i][y] = a[i]//pow(2,y)
        if a[i]//pow(2,y) == 0:
            break

s_table = [[0]*(int(log(a[-1],2))+2) for i in range(n)]
for i in range(n):
    s_table[i][0] = table[i][0]

import heapq
hq = []
heapq.heapify(hq)
h_push = heapq.heappush
h_pop = heapq.heappop

for i in range(n):
    for y in range(1,int(log(a[-1],2))+2):
        s_table[i][y] = table[i][y]-table[i][y-1]
        h_push(hq,table[i][y]-table[i][y-1])
        if table[i][y]-table[i][y-1] == -1:
            break


ans = sum(a)

for i in range(m):
    if not hq:
        print((0))
        exit()
    ans += h_pop(hq)
    
print(ans)
# Original solution
n,m = list(map(int, input().split()))
a = list(map(int, input().split()))

maxim = max(a)
minim = min(a)

while(maxim>minim*2 and m>=1):
    lmax=-1
    maxid=-1
    for i in range(n):
        if(lmax<a[i]):
            lmax=a[i]
            maxid=i
    maxim=lmax
    if(maxim<=minim*2):
        break
    a[maxid] = a[maxid]//2
    m-=1
    if(a[maxid]<minim):
        minim=a[maxid]
        
a.sort()
aa=a
a=[aa[n-1-i] for i in range(n)]
#print(a)

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

#print(a)
print((sum(a)))

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

b=[]

for i in range(n):
    for j in range(1+math.floor(math.log(a[i]+0.1)/math.log(2))):
        b.append(a[i]//(2**j)-a[i]//(2**(j+1)))
        
b.sort()
bb=b
b=[bb[len(b)-1-i] for i in range(len(bb))]


print((sum(a)-sum(b[0:m])))
# Original solution
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
for i in range(m):
    num=max(a)
    a.remove(num)
    a.append(num//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])
heapq.heapify(a)
for i in range(m):
    heapq.heappush(a, -1*(-heapq.heappop(a)//2))
print((sum(a)*-1))
# Original solution
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
for i in range(0,M):
    A[0]=int(A[0]/2)
    A.sort(reverse=True)

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)
for i in range(0,M):
    a=heapq.heappop(A)
    heapq.heappush(A,(-1)*(-a//2))
print((-sum(A)))

#　優先度付きキューが難しい
# Original solution
n,m=list(map(int,input().split()))

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


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


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

a=[-1*i for i in a]
heapq.heapify(a)
for i in range(m):
    ma=heapq.heappop(a)
    ma*=-1
    heapq.heappush(a,-1*(ma//2))
print((sum(a)*-1))
# Original solution
import heapq
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))

a=[-1*i for i in a]
heapq.heapify(a)
for i in range(m):
    ma=heapq.heappop(a)
    ma*=-1
    heapq.heappush(a,-1*(ma//2))
print((sum(a)*-1))


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

a=[-1*i for i in a]#最大値をとるため＊－１
heapq.heapify(a)#二分木の形にする
for i in range(m):#ｍ回
    ma=heapq.heappop(a)#listから最小（最大）を取り出しその値を記憶するためのma
    ma*=-1#-のままだと-3//2=2になってしまうので計算が合わない
    heapq.heappush(a,-1*(ma//2))#2で割った値に－１を懸けて戻す
print((sum(a)*-1))#https://qiita.com/T_Wakasugi/items/dac6eb77a3cace54f95e
# 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):
    p = a[n-1]//2
    a.pop()
    a.insert(bisect.bisect_left(a,p),p)

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)

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

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

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

    for _ in range(M):
        ins = A.pop() // 2
        A.insert(bisect.bisect_left(A, ins), ins)

    print((sum(A)))


if __name__ == '__main__':
    main()


# Optimized solution
import heapq

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

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

print((-sum(A)))
# Original solution
n,m=list(map(int,input().split()))
lst=list(map(int,input().split()))
for i in range(m):
    x=lst.index(max(lst))
    lst[x]=int(lst[x]/2)
print((sum(lst)))

# Optimized solution
import heapq
import math
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):
    heapq.heappush(a,math.ceil(heapq.heappop(a)/2))
   
    
    
print((-1*sum(a)))
# Original solution
import heapq

n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
k = len(A)
for i in range(k):
    A[i] = A[i] * -1

heapq.heapify(A)

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

for i in range(k):
    A[i] = int(A[i] * -1)

ans = sum(A)
print(ans)


# Optimized solution
import heapq

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

heapq.heapify(A)

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

ans = 0
for a in A:
    ans += int(-a)
print(ans)
# Original solution
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A = sorted(A, reverse=True)
for _ in range(M):
    A[0] = A[0]//2
    A = sorted(A, reverse=True)

print((sum(A)))

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

# Optimized solution
import heapq
N, M = list(map(int,input().split()))
h = []
for x in input().split():
  heapq.heappush(h, -int(x))
for i in range(M):
  x = -heapq.heappop(h)
  x //= 2
  heapq.heappush(h,-x)
print((-sum(h)))
# Original solution
import math
from copy import deepcopy
import sys
from itertools import combinations_with_replacement
def input():
    return sys.stdin.readline()[:-1]
# input
N, M = list(map(int, input().split()))
As = list(map(int, input().split()))
ind = [i for i in range(N)]

min_val = None
for combo in combinations_with_replacement(ind, M):
    price = deepcopy(As)
    for i in combo:
        price[i] = math.floor(price[i]/2)
    if min_val is None:
        min_val = sum(price)
    else:
        if sum(price) <= min_val:
            min_val = sum(price)

print(min_val)

# Optimized solution
import heapq
import sys
def input():
    return sys.stdin.readline()[:-1]

# input
N, M = list(map(int, input().split()))
a = []

for i in input().split():
    heapq.heappush(a, -int(i))

for j in range(M):
    highest = heapq.heappop(a)
    heapq.heappush(a, -(- highest // 2))

print((-sum(a)))
# Original solution
from collections import deque
n,m=list(map(int,input().split()))
a=sorted(deque(list(map(int,input().split()))),reverse=True)
for i in range(m):
  a[0]=a[0]//2
  a.sort(reverse=True)
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])
heapq.heapify(a)
for i in range(m):
  s=heapq.heappop(a)*(-1)
  heapq.heappush(a, (s//2)*(-1))

print((sum(a)*(-1)))
# Original solution
import heapq
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a = list([x * (-1) for x in a])
heapq.heapify(a)
while m != 0:
    price = heapq.heappop(a)
    price = price/2
    m -= 1
    heapq.heappush(a, price)

for i in range(len(a)):
    a[i] = int(a[i])
print((sum(a) * (-1)))

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

for i in range(len(a)):
    a[i] = a[i]*-1.0

heapq.heapify(a)
while m != 0:
    price = heapq.heappop(a)
    price = price/2
    m -= 1
    heapq.heappush(a, price)

for i in range(len(a)):
    a[i] = int(a[i])
    
print((sum(a) * (-1)))
# Original solution
from sys import stdin, setrecursionlimit
from bisect import insort


def main():
    input = stdin.buffer.readline
    n, m = list(map(int, input().split()))
    a = list(map(int, input().split()))
    a.sort()

    for _ in range(m):
        tmp = a[n - 1] // 2
        insort(a, tmp)

    print((sum(a[:n])))


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


# Optimized solution
from sys import stdin, setrecursionlimit
from heapq import heapify, heappop, heappush


def main():
    input = stdin.buffer.readline
    n, m = list(map(int, input().split()))
    a = list(map(int, input().split()))
    a = [-ai for ai in a]
    heapify(a)

    for _ in range(m):
        tmp = -heappop(a)
        heappush(a, -(tmp // 2))

    print((-sum(a)))


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
# Original solution
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 13 22:46:19 2019

"""

N,M=( int(x) for x in input().split())
A=[int(s) for s in input().split()]

for i in range(M):
    Pmax=max(A)
    Pmax_index=A.index(max(A))
    A[Pmax_index]=int(A[Pmax_index]/2)
    
print((sum(A)))

# Optimized solution
import heapq

N,M=( int(x) for x in input().split())
A=[int(s)*-1 for s in input().split()]

heapq.heapify(A)

for i in range(M):
    A_max=heapq.heappop(A)*-1
    heapq.heappush(A,(A_max//2)*-1)    
print((sum(A)*-1))
# Original solution
import sys
import heapq
n, m = list(map(int, sys.stdin.readline().split()))
A = list([-int(x) for x in sys.stdin.readline().split()])
heapq.heapify(A)

for j in range(m):
    heapq.heappush(A ,int(A[0]/2))
    heapq.heappop(A)

print((-sum(A)))

# Optimized solution
#ABC141D
#heapq 効率的にリストの最小値を取り出す
def main():
    import sys, heapq as h
    N, M = list(map(int, sys.stdin.readline().split()))
    A = list([-int(x) for x in sys.stdin.readline().split()])
    #print(A)
    h.heapify(A) #heap化
    #print(A)
    for m in range(M):
        a = h.heappop(A)
        #print(int(a/2))
        h.heappush(A, int(a/2))
        #print(A)
    print((-sum(A)))

if __name__ =='__main__':
    main()
# Original solution
#141D bisect
def main():
    import sys, bisect
    #from collections import deque
    
    N,M =list(map(int, sys.stdin.readline().split()))
    A = list(map(int, sys.stdin.readline().split()))
    A.sort()
    #print(A)
    while M:
        tmp = A.pop()
        bisect.insort(A, tmp//2)
        M-=1
    print((sum(A)))
   

if __name__=='__main__':
    main()


# Optimized solution
#ABC141D
def main():
    import sys
    import heapq as hp
    N, M = list(map(int, sys.stdin.readline().split()))
    A = list([-int(x) for x in sys.stdin.readline().split()])
    A.sort()
    hp.heapify(A)
    #print(A)
    while M>0:
        tmp = hp.heappop(A) #左から取り出す
        tmp = -((-tmp)//2)
        hp.heappush(A, tmp)
        M-=1
    print((-sum(A)))
   
if __name__=='__main__':
    main()
# Original solution
n, m = list(map(int, input().split()))
a = sorted(list(map(int, input().split())))

while m>0:
    max_a_ind=a.index(max(a))
    a[max_a_ind]=a[max_a_ind]//2
    m-=1

print((sum(a)))


# Optimized solution
from heapq import heappop,heappush,heapify
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7) 
 
n,m = list(map(int,input().split()))
a = [int(x) for x in 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
from heapq import heappop,heappush,heapify
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7) 
 
n,m = list(map(int,input().split()))
a = [int(x) for x in 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)))

# 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):
    tmp_min=heapq.heappop(a)
    heapq.heappush(a,(-1)*(-1*tmp_min//2))  # 計算誤差の関係で-1を2回かけてます
print((-sum(a)))
# Original solution
n,m = list(map(int,input().split()))

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

t.sort(reverse=True)

memo = []

for i in range(m):
    if len(memo) == 0:
        x=t.pop(0)
    elif len(t) == 0:
        x=memo.pop(0)
    elif t[0] >= memo[0]:
        x=t.pop(0)
    else:
        x=memo.pop(0)
    x = int(x/2)
    memo.append(x)
    #print(t)
print((sum(t)+sum(memo)))

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

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

for i in range(n):
    t[i] = -t[i]

t.sort()

for i in range(m):
    x=heapq.heappop(t)
    x = -x
    x = int(x/2)
    heapq.heappush(t,-x)
    #print(t)
print((-sum(t)))
# Original solution
import heapq

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

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

a = [-1*i for i in a]

heapq.heapify(a)

count = 0

while count < m:
    item = heapq.heappop(a)
    item= abs(item)
    discount_item = item//2
    heapq.heappush(a,-1*discount_item)
    count += 1

print((abs(sum(a))))

# Optimized solution
import heapq

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

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

memo = []
for t in T:
    memo.append(-t)
memo.sort()

for m in range(M):
    tmp = heapq.heappop(memo)
    tmp = int(tmp/2)
    heapq.heappush(memo,tmp)
print((-1*sum(memo)))
# Original solution
from bisect import bisect

#n:shinamono no kazu
#m:waribiki maisuu

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

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

indexMax=len(a)-1

for _ in range(m):
  maxA=a[indexMax]
  a.pop(indexMax)
  a.insert(bisect(a, maxA/2.0), maxA/2.0)

#print(a)
result=0
for item in a:
  result+=item//1
  
print((int(result)))

# Optimized solution
#n:shinamono no kazu
#m:waribiki maisuu
import heapq

n,m=list(map(int,input().split()))
a=list([int(x)*(-1) for x in input().split()])
#print(temp)
heapq.heapify(a)
for _ in range(m):
  minA=heapq.heappop(a)
  #print(minA)
  heapq.heappush(a,minA/2.0)
  #print(a)
#print(a)
result=0
for item in a:
  result+=item*(-1)//1
  
print((int(result)))
# Original solution
import math
#math.floor
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
result = 0
for i in a:
    result += math.floor(i)
print(result)

# Optimized solution
from heapq import heapify, heappush, heappop
from math import floor
n, m = list(map(int, input().split(' ')))
a = list(map(int, input().split(' ')))
a = [x*(-1) for x in a]
heapify(a)
for _ in range(m):
    x = floor(-heappop(a)/2)*(-1)
    heappush(a, x)

print((-sum(a)))
# Original solution
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
for _ in range(M):
  i = A.index(max(A))
  A[i] = A[i]//2
print((sum(A)))

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

# print(N)
# print(M)

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

A = sorted(A, reverse=True)
# print(A)

for i in range(M):
    # print(i)
    A[0] = int(A[0] / 2)
    A = sorted(A, reverse=True)
    
print((sum(A)))

# Optimized solution
import heapq

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

hq = []
A = list(map(int, input().split()))
for x in A:
    heapq.heappush(hq, -x)
    
# print(hq)

for i in range(M):
    x = heapq.heappop(hq)
    x = int(x / 2)
    # print(x)
    heapq.heappush(hq, x)

# print(hq)
ans = 0
for x in hq:
    ans += -x
print(ans)
# Original solution
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))

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

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)

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

print((-sum(A)))
# Original solution
def main():
    [N, M] = [int(num) for num in input().split()]
    A = [int(num) for num in input().split()]

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

    A = [a//1 for a in A]
    print((int(sum(A))))

if __name__ == '__main__':
    main()


# Optimized solution
import heapq

def main():
    [N, M] = [int(num) for num in input().split()]
    A = [int(num) for num in input().split()]
    hp = []

    for a in A:
        heapq.heappush(hp, - a)

    for i in range(M):
        expensive = heapq.heappop(hp)
        heapq.heappush(hp, expensive / 2)

    hp = [int(- a // 1) for a in hp]
    print((sum(hp)))


if __name__ == '__main__':
    main()