CodeEff/ECCO huggingface dataset:
# Original solution
N,M = list(map(int, input().split()))
A = [int(a) for a in input().split()]

A.sort(reverse=True)

for i in range(M):
    if i == 0:
        A[0] = A[0]//2
    else:
        temp = A[0]
        idx = 0
        j = 0
        while j < N and j <= i:
            if temp < A[j]:
                temp = A[j]
                idx = j
            j += 1
        A[idx] = A[idx]//2
        
print((sum(A)))

# Optimized solution
N,M = list(map(int, input().split()))
A = [int(a) for a in input().split()]

import heapq

h = []
for i in range(N):
    heapq.heappush(h, A[i]*(-1))
    
for i in range(M):
    temp = heapq.heappop(h)
    temp *= (-1)
    temp //= 2
    temp *= (-1)
    heapq.heappush(h, temp)
    
print((sum(h)*(-1)))
# Original solution
import heapq

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

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

for i in  range (0,len(A)):
    A[i]*=(-1)

heapq.heapify(A)

def chaep(n):
    n=int(n/2)
    return  n
i=0
while(i<M):
    tmp=heapq.heappop(A)
    tmp=chaep(tmp)
    heapq.heappush(A,tmp)
    i+=1

ans=0
for i in range (0,N):
    ans+=A[i]

print((ans*(-1)))

# Optimized solution
import heapq

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

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

for i in  range (0,len(A)):
    A[i]*=(-1)

heapq.heapify(A)

def chaep(n):
    n=int(n/2)
    return  n
i=0
while(i<M):
    tmp=heapq.heappop(A)
    tmp=chaep(tmp)
    heapq.heappush(A,tmp)
    i+=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.sort()
    A[len(A)-1] = A[len(A)-1] // 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)
ans = 0
for i in range(M):
    most_expensive = -heapq.heappop(A)
    most_expensive //= 2
    heapq.heappush(A, -most_expensive)
print((-sum(A)))
# Original solution
#import numpy as np
import sys

input = sys.stdin.readline

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

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

print((sum(A)))

# Optimized solution
import sys
import heapq
from math import ceil

input = sys.stdin.readline

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

hq = []
for i in range(N):
    heapq.heappush(hq, -A[i])

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

print((-sum(hq)))
# Original solution
n,m=list(map(int,input().split()))
l=list(map(int,input().split()))
for i in range(m):
  max=l[0]
  index=0
  for j in range(n):
    if max<l[j]:
      max=l[j]
      index=j
  l[index]=max//2
sum=0
for i in range(n):
  sum+=l[i]
print(sum)

# Optimized solution
n,m=list(map(int,input().split()))
l=list(map(int,input().split()))
import heapq
q=[]
for i in l:
  heapq.heappush(q,-i)
for i in range(m):
  num=heapq.heappop(q)
  if num%2==0:
    num=num//2
  else:
    num=num//2+1
  heapq.heappush(q,num)
sum=0
for i in range(n):
  sum+=-q[i]
print(sum)
# Original solution
import bisect

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

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

print((sum([int(i) for i in a])))

# Optimized solution
import heapq

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,heapq.heappop(a)/2)
 
print((sum([int(i) for i in a])*-1))
# Original solution
n,m = list(map(int,input().split()))
price = list(map(int,input().split()))

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

print((sum(price)))

# Optimized solution
import math        # factorical（階乗) # hypot(距離)
import heapq
# from fractions import gcd # Python3.5以前 # lcm（最小公倍数） = (a*b)//gcd(a,b)
# from fractions import Fraction
# from math import gcd # Python3.6以降
# --------------------------------------------------------------

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

price = [-i for i in price]

heapq.heapify(price)

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

price = [-i for i in price]

print((sum(price)))
# Original solution
n, m = list(map(int, input().split()))
a = [int(_) for _ in input().split()]

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

print((sum([int(_) for _ in a])))
  

# Optimized solution
import heapq

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

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

print((sum([int(-1*_) for _ in que])))
# Original solution
import bisect as b
import math

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

for _ in range(m):
    half = a.pop(-1) / 2
    a.insert(b.bisect_left(a, half), half)

print((sum(list([math.floor(x) for x in a]))))


# 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 _ in range(m):
    heapq.heappush(a, math.ceil(heapq.heappop(a) / 2))

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

for i in range(m):
    list_A = sorted(list_A)
    list_A[-1] = int(list_A[-1]/2)

            # print(i, j, list_A[j])

print((sum(list_A)))

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

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
# coding: utf-8
# Your code here!

import bisect

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

for _ in range(M):
    a = A.pop()
    a = a / 2
    bisect.insort_right(A, a)
    
print((sum([int(x) for x in A])))
    

# Optimized solution
# coding: utf-8
# Your code here!

import heapq

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

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

for i in range(M):
    temp = A.index((max(A)))
    tempM = M
    while temp == A.index((max(A))):
        if tempM > M:
            break
        A[A.index((max(A)))] //= 2
        M -= 1

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)
while m != 0:
    price = heapq.heappop(a) * (-1)
    price //= 2
    m -= 1
    heapq.heappush(a, (-1) * price)
print((sum(a) * (-1)))
# Original 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)

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

print((-sum(A)))


# Optimized solution
import heapq
def f(str):
    return -int(str)

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

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

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

def main():
    _,M,*A = list(map(int, open(0).read().split()))

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

    print((sum(A)))

if __name__=='__main__':
    main()

# Optimized solution
import sys
from heapq import heappush, heappop

def main():
    _,M,*A = list(map(int, open(0).read().split()))

    A = [-x for x in A] # reverse max to min
    A.sort()

    for _ in range(M):
        a = int(heappop(A) / 2)
        heappush(A, a)
    print((-sum(A)))

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

for i in range(m):
    max_a = max(a)
    a.append(max_a / 2)
    a.remove(max_a)

res_list = [int(_) for _ in a]
print((sum(res_list)))

# Optimized solution
import heapq

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

heapq.heapify(a)

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

res_list = [int(-_) for _ in a]
print((sum(res_list)))
# Original solution
n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
for i in range(m):
  v = max(a)//2
  a[a.index(max(a))] = v
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):
  maxv = heapq.heappop(a)*(-1)
  heapq.heappush(a,(maxv//2)*(-1))
print((sum(a)*(-1)))
# Original solution
import heapq as hq
n,m=list(map(int,input().split()))
a=list([-int(x) for x in input().split()])
hq.heapify(a)
for i in range(m):v=-hq.heappop(a);hq.heappush(a,-(v//2))
print((-sum(a)))

# Optimized solution
import heapq as hq
n,m=input().split()
hq.heapify(a:=[-int(x) for x in input().split()])
for i in range(int(m)):hq.heappush(a,-(v:=-hq.heappop(a)//2))
print((-sum(a)))
# Original solution
from math import floor
from bisect import insort_left
n, m = list(map(int, input().split()))
l = list(map(int, input().split()))
l.sort()
for i in range(m):
  a = l.pop(-1)
  a /= 2
  insort_left(l, a)
ans = 0
for i in range(n):
  ans += floor(l[i])
print(ans)

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

input = sys.stdin.readline
N, M = list(map(int, input().split()))
A = [int(x) for x in input().split()]
m_idx = A.index(max(A))

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

print((sum(A)))

# Optimized solution
import sys
import heapq

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

A = []
for x in input().split():
    heapq.heappush(A, int(x) * (-1))

for _ in range(M):
    max_n = heapq.heappop(A) * (-1)
    heapq.heappush(A, (max_n // 2) * (-1))
    
print((sum(A) * (-1)))
# Original solution
# D - Powerful Discount Tickets

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

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

print((sum(A)))


# Optimized solution
# D - Powerful Discount Tickets

import heapq

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

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

print((sum(A) * -1))
# 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=[-int(x) for x in input().split()]
heapq.heapify(a)
for i in range(m):
  t=heapq.heappop(a)
  t=-t//2
  heapq.heappush(a,-t)
print((-sum(a)))
# Original solution
N,M = list(map(int,input().split()))
A = sorted(list(map(int,input().split())),reverse = True)
while M > 0:
    A[0] //= 2
    for i in range(1,M):
        if i < N and A[i] >= A[0]:
            A[i] //= 2
        else:
            M -= i
            A.sort(reverse = True)
            break
    else:
        break
print((sum(A)))


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

a = sorted(list(map(int,input().split())),reverse=True)
for i in range(m):
    a[0] = a[0]/2
    a = sorted(a,reverse=True)
print((sum(list(map(int,a)))))

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



if __name__ == "__main__":
    main()
# Original solution
def main():
    import heapq
    n,m = list(map(int,input().split()))
    a = list(map(int,input().split()))
    heap = []
    for i in range(n):
        heapq.heappush(heap,-1*a[i])
    for i in range(m):
        a = int(heapq.heappop(heap)/2)
        heapq.heappush(heap,a)
    print((-1*sum(heap)))



if __name__ == "__main__":
    main()

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

if __name__ == "__main__":
    main()
# Original solution
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))

sum=0

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

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

sum=0
A=[-1 * i for i in A]
heapq.heapify(A)

for m in range(M):
    rep=-(-heapq.heappop(A)//2)
    heapq.heappush(A,rep)
for a in A:
    sum-=a

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

# Optimized solution
import heapq

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

for i in range(n[1]):
  x=(-1*m[0])//2
  heapq.heappop(m)
  heapq.heappush(m, -x)

ans=0
for i in range(n[0]):
  ans+=-m[i]

print(ans)
# Original solution
n,m = list(map(int,input().split()))
price_list = sorted(list(map(int,input().split())),reverse = True)
for i in range(m):
    n = max(price_list)
    price_list.remove(n)
    price_list.append(n//2)
print((sum(price_list)))

# Optimized solution
import heapq
n,m = list(map(int,input().split()))
price_list =list([-int(x) for x in input().split()])
heapq.heapify(price_list)

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

A = sorted(A)
for i in range(m):
    a = A[-1]//2
    A = A[:-1]
    A.append(a)
    A = sorted(A)
print((sum(A)))

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

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

import heapq

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

heapq.heapify(A)

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

print((sum(list([x*(-1) for x in A]))))
# Original solution
N, M = list(map(int, input().split()))
Am = list(map(int, input().split()))
A = sorted(Am, reverse=True)
A.append(0)
for m in range(M):
    a = int(A[0] / 2)
    n = 0
    while A[n + 1] > a and n < N - 1:
        n += 1
    del A[0]
    A.insert(n,a)
print((sum(A)))

# Optimized solution
import heapq

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

# 入力の取得(1行目。数値)
i = list(map(int, input().split()))

# 変数セット
# 1.購入する品物の数
itemCount = i[0]
# 2.割引券の数
discountTicketsCount = i[1]

# 入力の取得(2行目。数値)
priceList = list(map(int, input().split()))

# 割引件数分ループ
for i in  range(discountTicketsCount):

    # 全アイテムに対して、割引券を使った場合の試算を行う
    discountPrice = 0
    shouldUseItem = 0
    for idx , price in enumerate(priceList):

        # 割引券使用による割引金額を取得
        workDiscountPrice = math.ceil(price - (price / 2))

        # 最も割引金額が多い場合、候補として変数に格納
        if workDiscountPrice > discountPrice:
            discountPrice = workDiscountPrice
            shouldUseItem = idx

    # 割引金額が最大の品物に割引券を使用
    priceList[shouldUseItem] -= discountPrice

# 合計金額を出力
print((sum(priceList)))


# Optimized solution
import math
import heapq

# 入力の取得(1行目。数値)
i = list(map(int, input().split()))

# 変数セット
# 1.購入する品物の数
itemCount = i[0]
# 2.割引券の数
discountTicketsCount = i[1]

# 入力の取得(2行目。数値)
priceList = list(map(int, input().split()))

# 「符号反転した」リストを優先度付きキューに変換
# ★ポイント★
# heapqは最小値しか取り出せないため、
# 符号反転してからキューに変換=>最小値を取る、という手法を行う。
priceList = [ n * -1 for n in priceList]
heapq.heapify(priceList)

# 割引件数分ループ
for i in  range(discountTicketsCount):

    # キューから最小値の取り出し(ここで符号反転も行っておく)
    target = abs(heapq.heappop(priceList))

    # 2で割る。(小数点切り下げ)
    target = math.floor(target / 2)

    # 割引券利用後の金額をキューに格納(ここで符号反転する)
    heapq.heappush(priceList, target * -1)

# 合計金額を出力
print((abs(sum(priceList))))
# Original solution
import math

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

d = {}
for i, a in enumerate(aL):
    if a in d:
        d[a].append(i)
    else:
        d[a] = [i]

cnt = 0
while True:
    if len(d) == 0:
        break
    dMax = max(d)
    while True:
        if cnt == m:
            ans = 0
            for k, v in list(d.items()):
                ans += k * len(v)
            print(ans)
            exit()
        nxt = d[dMax].pop(0)

        if (dMax // 2) in d:
            d[dMax // 2].append(nxt)
        else:
            d[dMax // 2] = [nxt]

        cnt += 1

        if len(d[dMax]) == 0:
            del d[dMax]
            break

ans = 0
for k, v in list(d.items()):
    ans += k * len(v)
print(ans)

# Optimized solution
import heapq

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

heapq.heapify(aL)

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

print((int(sum(aL) * -1)))
# Original solution
import bisect
N, M = list(map(int, input().split()))
A = sorted(map(int, input().split()))
for _ in range(M):
    x = A.pop()
    y = x // 2
    i = bisect.bisect_left(A, y)
    A.insert(i, y)
ans = sum(A)
print(ans)

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

A.sort(reverse=True)

for i in range(M):
    # idx = A.index(max(A))
    # A[idx] //= 2
    idx = A.index(max(A[:i+1]))
    A[idx] //= 2
 
print((sum(A)))

# Optimized solution
import heapq

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

A_minus = [-int(a) for a in A]
heapq.heapify(A_minus)

for _ in range(M):
    tmp = -heapq.heappop(A_minus)
    tmp //= 2
    heapq.heappush(A_minus, -tmp)
 
print((-sum(A_minus)))
# 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
n,m = list(map(int, input().split()))
a = list([int(x)*(-1) for x in input().split()])
import heapq
heapq.heapify(a)
for _ in range(m):
    num = heapq.heappop(a)
    heapq.heappush(a,(-num//2)*(-1))
print((-sum(a)))
# Original solution
import bisect

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

A_list = sorted(A_list)
#print(A_list)

for i in range(M):
    val = A_list.pop()//2
    bisect.insort_left(A_list, val, lo=min(N-1, max(0,(N-M) + i)) )

print((sum(A_list)))

# Optimized solution
import heapq

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

heapq.heapify(A_list)

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

print((sum(A_list) * -1))
# Original solution
n, m = list(map(int, input().split()))
alist = list(map(int, input().split()))

for i in range(m):
    num = max(alist)
    num = num >> 1

    alist.remove(max(alist))
    alist.append(num)

print((sum(alist)))


# Optimized solution
import heapq


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

for i in range(m):
    minus_max = alist[0]
    heapq.heapreplace(alist, ((-1)*minus_max >> 1)*(-1))

print((-1*sum(alist)))
# Original solution
# -*- coding: utf-8 -*-
"""
Created on Wed Oct  2 07:56:16 2019

@author: avina
"""
from queue import PriorityQueue as Q
n,t = list(map(int,input().split()))

q = Q()
for i in input().split():
    a = -1*int(i)
    q.put(a)

while t >0:
    a = -1*(q.get())
    a = -1*(a//2)
    q.put(a)
    t-=1

ans = 0
while q.qsize()>0:
    ans += q.get()
print((-1*ans))

# Optimized solution
# -*- coding: utf-8 -*-
"""
Created on Thu Oct  3 07:43:37 2019

@author: avina
"""

import heapq

class Maxheap():
    
    def __init__(self, x):
        self.heap = [-e for e in x]
        heapq.heapify(self.heap)
    
    def push(self, value):
        heapq.heappush(self.heap, -value)
    
    def pop(self):
        return -heapq.heappop(self.heap)

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

l = list(map(int, input().split()))
a = Maxheap(l)
for i in range(t):
    b = a.pop()//2
    a.push(b)
    
sums = 0
for i in range(n):
    sums += a.pop()
print(sums)
# Original solution
n,m=list(map(int,input().split()))
l=list(map(int,input().split()))
l=sorted(l)

while m>0:
    a=l[len(l)-1]
    l.pop()
    l.append(a//2)
    l=sorted(l)
    m=m-1

print((sum(l)))


# Optimized solution
import heapq

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

heapq.heapify(l)

while m>0:
    a=heapq.heappop(l)
    if a//2==a/2:
        heapq.heappush(l,a//2)

    else:
        heapq.heappush(l,a//2+1)
    m=m-1

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

for _ in range(0, M, 1):
	A[0] >>= 1
	for i in range(1, len(A), 1):
		if A[i - 1] < A[i]:
			A[i], A[i - 1] = A[i - 1], A[i]
		else:
			break

print((sum(A)))

# Optimized solution
import heapq

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

for i in range(0, M, 1):
	heapq.heappush(A, -(-heapq.heappop(A) >> 1))

print((-sum(A)))
# Original solution
n, m = [int(v) for v in input().split()]
values = sorted([int(v) for v in input().split()], reverse=True)

def insert(arr, val):
    left, right = 0, len(arr) - 1
    while right - left > 1:
        index = (left + right) // 2
        if val <= arr[index]:
            left = index
        else:
            right = index
    return arr[0:(left + 1)] + [val] + arr[(left + 1):]

for _ in range(m):
    v = values[0] >> 1
    values = insert(values[1:], v)

print((sum(values)))

# Optimized solution
from heapq import heappush, heappop, heapify

n, m = [int(v) for v in input().split()]
values = [-int(v) for v in input().split()]
heapify(values)

for _ in range(m):
    v = -((-heappop(values)) >> 1)
    heappush(values, v)

print((-sum(values)))
# Original solution
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] //= 2
print((sum(a)))


# Optimized solution
import heapq
n,m = list(map(int, input().split()))
a = list(map(int, input().split()))
hq = []
for j in range(n):
    aa = a[j] * -1
    heapq.heappush(hq, aa)
for i in range(m):
    maxim = heapq.heappop(hq) * -1
    maxim //= 2
    maxim *= -1
    heapq.heappush(hq, maxim)
print((-1 * sum(hq)))
# 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))]=((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)
  y=(((-1)*x)//2)*(-1)  
  heapq.heappush(A,y)
print(((-1)*sum(A)))