CodeEff/ECCO huggingface dataset:
# Original solution
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,m = inpl()
a = inpl()
hq = []
heapq.heapify(hq)
ans = 0
for i in range(n):
    tt = a[i]
    heapq.heappush(hq,-tt)
for i in range(m):
    tmp = heapq.heappop(hq)
    tmp /= 2
    heapq.heappush(hq,tmp)
    # print(hq)
for i in range(n):
    tttt = heapq.heappop(hq)
    ans -= math.ceil(tttt)
print(ans)

# Optimized solution
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,m = inpl()
a = inpl()
a = [-x for x in a]
heapify(a)
for _ in range(m):
    now = heappop(a)
    now /= 2
    heappush(a,now)
    # print(now)
res = 0
for x in a:
    res += int(-x)
print(res)
# Original solution
import bisect

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

for i in range(m):
    value = a[-1] // 2
    del a[-1]
    bisect.insort(a, value)

print((sum(a)))

# Optimized solution
import heapq


def neg_int(a):
    return -1 * int(a)


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

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

print((sum(a) * -1))
# Original solution
import bisect

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

while M > 0:
    a = A.pop()
    bisect.insort(A, a//2)
    M -= 1

print((sum(A)))

# Optimized solution
import heapq

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

for _ in range(M):
    tmin = heapq.heappop(A)
    heapq.heappush(A, (-1)*(-tmin//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.sort()
    A[N-1] = int(A[N-1] / 2)

result = 0

for i in range(N):
    result += A[i]

print(result)

# Optimized solution
import heapq
N,M = list(map(int , input().split(" ")))
A = list(map(int, input().split(" ")))

A_q = list([x*(-1) for x in A])
heapq.heapify(A_q)

for i in range(M):

    max = heapq.heappop(A_q) * (-1) // 2
    heapq.heappush(A_q, -max)



result = 0
A_q = list([x*(-1) for x in A_q])

for i in range(N):
    result += A_q[i]

print(result)
# Original solution
def main():
  import bisect
  n,m = list(map(int,input().split()))
  a = sorted(list(map(int,input().split())))
  for _ in range(m):
    x= a.pop(-1)/2
    index = bisect.bisect_left(a, x) 
    a.insert(index, x)
  print((int(sum(i//1 for i in a))))
if __name__=='__main__':
  main()

# Optimized solution
def main():
  import heapq
  n,m = list(map(int,input().split()))
  a =sorted(list([int(x)*(-1) for x in input().split()]))
  heapq.heapify(a)
  for _ in range(m):
    x=heapq.heappop(a)/2
    heapq.heappush(a,x) 
  print((int(sum((-1)*i//1 for i in a))))
if __name__=='__main__':
  main()
# Original solution
import sys
def input():
    return sys.stdin.readline()[:-1]
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):
    # print(a)
    tmp=heapq.heappop(a)
    tmp=tmp*-1
    tmp=tmp//2
    tmp*=-1
    heapq.heappush(a,tmp)
    heapq.heapify(a)
print((sum(a)*-1))

# Optimized solution
import sys
def input():
    return sys.stdin.readline()[:-1]
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):
    # print(a)
    tmp=heapq.heappop(a)
    tmp=tmp*-1
    tmp=tmp//2
    tmp*=-1
    heapq.heappush(a,tmp)

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

ans = 0
for i in range(n):
    ans += a[i] // 1

print((int(ans)))


# 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, heapq.heappop(a) / 2)

ans = 0
for i in range(n):
  ans += -a[i] // 1

print((int(ans)))
# Original solution
import bisect

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

for i in range(m):
    x = a.pop() // 2
    bisect.insort_right(a, x)

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):
    x = heapq.heappop(a)
    heapq.heappush(a, (-1) * (-x // 2))

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

# Optimized solution
from heapq import heapify, heappop, heappush
import math
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(n):
    a[i] = a[i] * -1
heapify(a)
for _ in range(m):
    minval = heappop(a)
    heappush(a, math.ceil(minval / 2))
ans = 0
for i in range(n):
    ans += int(a[i])
print((-ans))
# Original solution
NM = input().split(" ")
A_LIST = input().split(" ")
A = []
for i in A_LIST:
    A.append(int(i))

N = int(NM[0])
M = int(NM[1])

#.sort()
for i in range(0, M):
    m = max(A)
    n = A.index(m)
    m = m // 2
    A[n] = m
S = 0
for i in A:
    S += i
print(S)

# Optimized solution
import heapq

NM =input().split(" ")
A_LIST = input().split(" ")
N = int(NM[0])
M = int(NM[1])

A = []
for i in A_LIST:
    heapq.heappush(A, -1 * int(i))
    
for i in range(0, M):
    m = heapq.heappop(A)
    m = -1 * m
    m = m // 2
    heapq.heappush(A, -1 * m)

S = 0    
for i in A:
    S += (-1 * i)

print(S)
# Original solution
from collections import Counter
import math
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
#rec(N-1,M)
res=dict(Counter(A))
while M>0:
    #ex=max(list(map(float,res.keys())))
    ex=max(res.keys())
    n=res[ex]
    val=ex//2
    if n<=M:
        M-=n
        del res[ex]
        
        if val in list(res.keys()):
            res[val]+=n
        else:
            res[val]=n
            
        
    else:
        n=M
        res[ex]-=n
        if val in list(res.keys()):
            res[val]+=n
        else:
            res[val]=n
        M=0
    
ans=0
for i in list(res.keys()):
    ans+=i*res[i]
print((int(ans)))

# Optimized solution
import heapq
import math
n,m=list(map(int,input().split()))
a=list([-1*int(x) for x in input().split()])

heapq.heapify(a)
for _ in range(m):
    tmp=heapq.heappop(a)
    cal=math.ceil(tmp/2)
    heapq.heappush(a,cal)
    
print((sum(a)*-1))
# Original solution
import copy
n,m=list(map(int,input().split()))

a=list(map(int,input().split()))
aorg=a[:]
waribiki=[0]*n

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

total=0
for i in range(n):
  if waribiki[i]!=0:
    aorg[i]=aorg[i]//(2**waribiki[i])
  total+=aorg[i]
print (total)



# Optimized solution
import copy
import heapq
import math
n,m=list(map(int,input().split()))
a=[0]*n
atmp=list(map(int,input().split()))
for i in range(n):
  a[i]=-atmp[i]

heapq.heapify(a)
for i in range(m):
  tmp=heapq.heappop(a)
  heapq.heappush(a,tmp/2)

total=0  
for i in range(n):
  total+=math.ceil(a[i])
print((-total))
# Original solution
N, M = list(map(int, input().split()))
A = sorted(list(map(int, input().split())), reverse=True)
for i in range(M):
  a = A.pop(0) // 2
  f = 0
  for j in range(N-2):
    if A[j] >= a >= A[j+1]:
      A.insert(j+1, a)
      f = 1
      break
  if f == 0:
    A.append(a)
print((sum(A)))

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

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

for i in range(m):
  a.sort()
  a[-1]=math.floor(a[-1]/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):
  m = heapq.heappop(a)
  heapq.heappush(a, (-m//2)*-1)

print((-sum(a)))
# Original solution
from bisect import insort_left 

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

for i in range(M):
    x = A.pop()
    insort_left(A,x//2)

print((sum(A)))


# Optimized solution
import heapq

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

A = list([-x for x in A])

heapq.heapify(A)

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

ans = 0

for i in range(N):
    x = heapq.heappop(A)
    ans += int(-x)

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()))

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

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

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

n, m = list(map(int, input().split()))
li = [-int(i) for i in input().split()]

for _ in range(m):
	heapq.heapify(li) 
	x = heapq.heappop(li)
	if x % 2 == 0:
		heapq.heappush(li, x // 2)
	else:
		heapq.heappush(li, x // 2 + 1)
print((-sum(list(li))))



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

n, m = list(map(int, input().split()))
li = [-int(i) for i in input().split()]
li = sorted(li)

for _ in range(m):
	x = heapq.heappop(li)
	#print(x)
	if x % 2 == 0:
		heapq.heappush(li, x // 2)
	else:
		heapq.heappush(li, x // 2 + 1)
	#print(li)
print((-sum(list(li))))
# Original solution
from heapq import heapify,heappush,heappop
from math import ceil
n,m,*a=list(map(int,open(0).read().split()))
a=[(-1)*x for x in a]
heapify(a)
for _ in range(m):
	x=heappop(a)
	heappush(a,ceil(x/2))
print((-sum(a)))

# Optimized solution
from heapq import*;n,m,*a=[-int(x) for x in open(0).read().split()];heapify(a)
for _ in[0]*-m:heappush(a,0-heappop(a)//-2)
print((-sum(a)))
# Original solution
# from pprint import pprint
# import math
# import collections

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

for _m in range(m):
    a = sorted(a, reverse=True)

    a[0] = a[0] // 2

ans = sum(a)
print(ans)


# Optimized solution
# from pprint import pprint
import math

# import collections

# n = int(input())
n, m = list(map(int, input().split(' ')))
a = list([int(x) * (-1) for x in input().split(' ')])
# a = sorted(a, reverse=True)
# b = [math.log2(_a) for _a in a]


import heapq

q_a = heapq.heapify(a)

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

print((sum(a) * (-1)))
# Original solution
import bisect
import copy

N,M = list(map(int,input().split()))
A = sorted(list(map(int,input().split())))
A2 = copy.deepcopy(A[N-M:])

for _ in range(M):
  tmp_a = int(A2[-1]/2)
  del A2[-1]
  A2.insert(bisect.bisect_left(A2,tmp_a),tmp_a)
print((sum(A[:N-M])+sum(A2)))

# Optimized solution
import heapq

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

cnt = 0
while cnt < M:
  a = heapq.heappop(A)
  heapq.heappush(A,-((-a)//2))
  cnt += 1
print((-sum(A)))
# Original solution
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
cnt = 0

while cnt < M:
    a = max(A)
    A[A.index(a)] = a//2
    cnt += 1

print((sum(A)))

# Optimized solution
import heapq
from math import ceil
n,m = list(map(int,input().split()))
a = [-int(i) for i in input().split()]
heapq.heapify(a)

for i in range(m):
    heapq.heappush(a,ceil(heapq.heappop(a)/2))

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

import bisect

for i in range(M):
  M = max(A)
  A.remove(M)
  x = M//2
  A.append(x)
print((sum(A)))

  

# Optimized solution
N, M = list(map(int, input().split()))
A = list([(-1)*int(x) for x in input().split()])
import heapq  # heapqライブラリのimport

heapq.heapify(A)  # リストを優先度付きキューへ

# 最小値の取り出し

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

print((sum(A)*(-1)))
# Original solution
# input
n, m = list(map(int, input().split()))
la = sorted(list(map(int, input().split())), reverse=True)

while m > 0:
    d = 0
    for i in range(n):
        if i < n-1 and la[i] >= la[i+1]:
            if la[i+1] > 0:
                d = la[i] // la[i+1]
            else:
                d = 1
            if d > m:
                d = m
                la[i] = la[i] // (2**d)
            else:
                la[i] = la[i] // (2**d)
            #print(la)
            for j in range(i, n-1):
                if la[j] <= la[j+1]:
                    tmp = la[j]
                    la[j] = la[j+1]
                    la[j+1] = tmp
                else:
                    break
            break
        else:
            la[i] = la[i] // 2
            d = 1
            break
    #la.sort(reverse=True)
    #print(la)
    # sprint(d)
    m -= d

print((sum(la)))


# Optimized solution
import heapq as h

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

h.heapify(la)

while m > 0:
    max = abs(la[0])
    h.heapreplace(la, (max // 2)*-1)
    m -= 1

print((abs(sum(la))))
# Original solution
x,y = list(map(int,input().split()))
li = list(map(int,input().split()))
score = 0
for i in range(y):
  li[li.index(max(li))] //= 2
print((sum(li)))

# Optimized solution
import heapq

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

heapq.heapify(li)

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

print((-sum(li)))
# Original solution
n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
i=0
while i<m:
  i+=1
  t=A.index(max(A))
  A[t]=A[t]//2
print((sum(A)))

# Optimized solution
N, M = list(map(int,input().split()))
A = list(map(int,input().split()))
A.sort(reverse = True)
it = 0
for i in range(M):
    A[it]=A[it]//2
    if it<N-1:
        if A[it]<A[it+1] and A[0]<A[it+1]:
            it+=1
        else:
            A.sort(reverse = True)
            it = 0
    if it == N-1:
        A.sort(reverse = True)
        it = 0
print((sum(A)))
# Original solution
n, m = list(map(int, input().split()))
a = list(map(float, input().split()))

a.sort()
for t in range(m):
  discount = a.pop() / 2.
  inserted = False
  for i in range(n - 1):
    if a[i] > discount:
      a.insert(i, discount)
      inserted = True
      break
  if not inserted:
    a.append(discount)
    
print((sum(map(int, a))))

# Optimized solution
import heapq

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

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

# dp = [[0 for i in range(N)] for _ in range(M)]

# sortedA = sorted(A,reverse=True)

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

print((sum(A)))

# Optimized solution
import heapq as hq

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

# dp = [[0 for i in range(N)] for _ in range(M)]

# sortedA = sorted(A,reverse=True)

A = list([x*-1 for x in A])

hq.heapify(A)
for i in range(M):
    m=hq.heappop(A)*-1
    hq.heappush(A,(m//2)*-1)
#     print(A)

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

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

print((sum(prices)))


# 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 _ in range(M):
    tmp = heapq.heappop(A) * (-1)
    tmp //= 2
    heapq.heappush(A, tmp * (-1))

print((-sum(A)))
# Original solution
import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
val = list(map(int,input().split()))
my_index = val.index
for i in range(m):
  val[my_index(max(val))] = max(val)//2
print((sum(val)))

# Optimized solution
import heapq
import sys
input = sys.stdin.readline
n, m = list(map(int, input().split()))
a = [int(i) for i in input().split()]
for i in range(n):
  a[i] *= -1

heapq.heapify(a)
for i in range(m):
    heapq.heapreplace(a, int(a[0] / 2))

print((sum(a)*-1))
# Original solution
import sys
import heapq
import math
input = sys.stdin.readline

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):
    max_a = heapq.heappop(a)
    max_a /= 2
    heapq.heappush(a, max_a)
for i in range(n):
    a[i] = math.floor(-a[i])
print((sum(a)))


# Optimized solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

import heapq

n, m = list(map(int, readline().split()))
a = list([int(x)*(-1) for x in readline().split()])
heapq.heapify(a)
for i in range(m):
    memo = heapq.heappop(a)
    heapq.heappush(a, (-memo // 2) * (-1))
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([int(x)*(-1) for x in input().split()])

heapq.heapify(A)

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

# Optimized solution
import heapq
n, m = list(map(int, input().split()))
a = [-int(i) for i in input().split()]
heapq.heapify(a)
for _ in range(m):
    heapq.heappush(a, ((heapq.heappop(a)*-1//2)*(-1)))
print((sum(a)*-1))
# Original solution
n,m=list(map(int,input().split()))
a=sorted(list(map(int,input().split())))[::-1]
i=0
while True:
    a[i]=a[i]//2
    a=sorted(a)[::-1]
    m-=1
    if m==0:
        break
print((sum(a)))

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


# Optimized solution
n,m = list(map(int,input().split()))
import math
a_list = list(map(int,input().split()))
for i in range(n):
  a_list[i] = -1 * a_list[i]
import heapq
heapq.heapify(a_list)
for j in range(m):
  
  a = heapq.heappop(a_list)
  a = math.ceil(a/2)
  heapq.heappush(a_list,a)


print((-1 * sum(a_list)))
# Original solution
import heapq

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

for i in range(N):
    A[i]*=-1
#print(A)
heapq.heapify(A)
for i in range(M):
    temp=heapq.heappop(A)
#    print(temp)
    heapq.heappush(A,temp//2+temp%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):
    temp=heapq.heappop(A)
    heapq.heappush(A,temp//2+temp%2)
    
print((-sum(A)))
# Original solution
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline
from decimal import Decimal

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

from heapq import heappush, heappop, heapify

heapify(a)
for i in range(m):
    tmp_min = heappop(a)/2
    heappush(a,tmp_min)

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

# Optimized solution
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline

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

from heapq import heappush, heappop, heapify

heapify(a)
for i in range(m):
    tmp_min = (-1)*heappop(a)//2*(-1)
    heappush(a,tmp_min)

print((sum(list([int(x * (-1)) for x in a]))))
# Original solution
import math

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

for i in range(m):
    a = sorted(a, reverse=True)
    a[0] = math.floor(a[0] / 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 _ in range(m):
    tmp_min = heapq.heappop(a)
    heapq.heappush(a, (-1) * (-tmp_min // 2))

print((-sum(a)))
# Original solution
(n, m) = list(map(int, input().split()))
a = sorted(list(map(int, input().split())), reverse = True)

while m > 0:
    found = False
    for i in range(n-1):
        if a[i] < a[i+1]:
            a[i+1] = int(a[i+1] / 2)
            found = True
            break
    if not found:
        a[0] /= 2
    m -= 1
sum = 0
for a_i in a:
    sum += int(a_i)
print(sum)


# Optimized solution
import math
import heapq

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

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

sum = 0
for a_i in a:
    sum += int(-1 * a_i)
print(sum)
# Original solution
N,M = list(map(int,input().split()))

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

while M > 0:
    num = lis.index(max(lis))
    lis[num] = int(lis[num] / 2)
    M -= 1

sum = 0

for i in range(len(lis)):
    sum += lis[i]
print(sum)

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

import heapq
heapq.heapify(lis)
for _ in range(M):
    tmp = -heapq.heappop(lis)
    tmp //= 2
    heapq.heappush(lis,-tmp)

print((-sum(lis)))
# Original solution
N,M = list(map(int,input().split()))
L = list(map(int,input().split()))
for j in range(M):
    idx = L.index(max(L))
    L[idx] //=  2
    
print((sum(L)))

# Optimized solution
import heapq

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

q=[]
for l in L:
    heapq.heappush(q, -l)

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

print((-sum(q)))
# Original solution
'use strict'
import math
N, M = list(map(int, input().split()))
goods_price_list = list(map(int, input().split()))

for i in range(M):
  max_index = goods_price_list.index(max(goods_price_list))
  goods_price_list[max_index] = math.floor(goods_price_list[max_index]/2)

print((sum(goods_price_list)))

# Optimized solution
'use strict'
import heapq

N, M = list(map(int, input().split()))
goods_price_list = [-int(_) for _ in input().split()]

heapq.heapify(goods_price_list)

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

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

# Optimized solution
import heapq

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