CodeEff/ECCO huggingface dataset:
# Original solution
if __name__ == "__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)))
    

# Optimized solution
import heapq

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

    for i in range(M):
        tmp = heapq.heappop(A)
        v = tmp[1] // 2
        heapq.heappush(A, (-v, v))
    
    res = 0
    for i in range(len(A)):
        res += A[i][1]
    
    print(res)
# Original solution
n, m = list(map(int, input().split()))
a = [int(_) for _ in input().split()]
a.sort(reverse=True)

ans = 0
search_idx = 0

for i in range(m):
    max_idx = 0
    if search_idx+2 >= n:
        search_idx = n - 2
    for j in range(0, search_idx+2):
        if a[max_idx] < a[j]:
            max_idx = j
        if search_idx < max_idx:
            search_idx = max_idx
    a[max_idx] //= 2
    #print(a)

print((sum(a)))

# Optimized solution
import heapq

# 「優先度付きキュー」の練習問題

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

# 各要素を-1倍する。最大値の取り出しができるように
a = list([x*(-1) for x in a])
# aの優先度付きキューに
heapq.heapify(a)

# 割引m回分ループ
for _ in range(m):
    popNum = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-popNum//2))

# 負で出力されているので戻す
print((-sum(a)))
# Original solution
I = list(map(int,input().split()))
N = I[0]
M = I[1]
A = list(map(int,input().split()))

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

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

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

print((-sum(A)))
# Original solution
from sys import stdin
import math
import fractions

n, m = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]

a.sort(reverse=True)

for i in range(m):
    a[0] = int(a[0]/2)
    a.sort(reverse=True)

print((sum(a)))

# Optimized solution
from sys import stdin
import math
import fractions
import heapq

n, m = [int(x) for x in stdin.readline().rstrip().split()]
a = [int(x) for x in stdin.readline().rstrip().split()]

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

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

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

#print(A)

for i in range(m):
    if i == 0:
        A[0] = A[0]//2
    else:
        list = A[0:i+1]
#        print(list)
        max_num = max(list)
        max_id = list.index(max_num)
        A[max_id] = max_num//2

#print(A)
print((sum(A)))


# Optimized solution
import heapq

n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
list = []
maximum = 0

for i in range(n):
    num = a[i]*(-1)
    heapq.heappush(list,num)

for i in range(m):
    maximum = heapq.heappop(list)
    if maximum%2 == 0:
        maximum = maximum//2
    else:
        maximum = (maximum//2)+1
    heapq.heappush(list,maximum)
#    print(list)

ans = 0
minimum = 0

for i in range(n):
    minimum = heapq.heappop(list)
    minimum = minimum*(-1)
    ans = ans + minimum

print(ans)
# Original solution
N, M = list(map(int, input().split()))
As = list(map(int, input().split()))

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


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

As = list([-1 * int(x) for x in input().split()])

heapq.heapify(As)

for i in range(M):
  tmp = heapq.heappop(As)
  tmp = (-1 * tmp) // 2 * (-1) 
  heapq.heappush(As, tmp)
  
print((-1 * sum(As)))
# Original solution
import bisect
import math
import sys
imput = sys.stdin

N, M = [int(item) for item in input().rstrip().split()]
As = sorted([float(item) for item in input().rstrip().split()])
for i in range(M):
    _t = As.pop()
    bisect.insort_right(As, _t/2)
    
_sum = sum([math.floor(item) for item in As])
print(_sum)


# Optimized solution
import heapq
 
N, M = [int(item) for item in input().rstrip().split()]
hp = [-1 * int(item) for item in input().rstrip().split()]
heapq.heapify(hp)

for i in range(M):
    _t = heapq.heappop(hp)
    heapq.heappush(hp, -1 * (-1 * _t // 2))
    
_sum = sum([-1 * int(item) for item in hp])
print(_sum)
# Original solution
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
import heapq
input=sys.stdin.readline
def resolve():
    n,m=list(map(int,input().split()))
    A=list([-(int(x)) for x in input().split()])
    heapq.heapify(A)
    for _ in range(m):
        a=heapq.heappop(A)
        a=-a
        a=a>>1
        heapq.heappush(A,-a)
    print((-sum(A)))

resolve()

# Optimized solution
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    from heapq import heapify,heappop,heappush
    n,m=list(map(int,input().split()))
    A=[-a for a in map(int,input().split())]
    heapify(A)
    for _ in range(m):
        x=-heappop(A)
        heappush(A,-(x//2))
    print((-sum(A)))
resolve()
# Original solution
from math import ceil
from heapq import heappop,heappush
from collections import deque
N,M = list(map(int,input().split()))
a = list(map(int,input().split()))
a = list([x*(-1) for x in a])
A = []

for a_ in a:
    heappush(A,a_) 

for _ in range(M):
  maxA = ceil(heappop(A)/2)
  A.append(maxA)
  
ans = sum(A)*-1
print(ans)

# Optimized solution
from math import ceil
from heapq import heappop,heappush

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

for a_ in a:
    heappush(A,a_) 

for _ in range(M):
  maxA = ceil(heappop(A)/2)
  A.append(maxA)
print((-sum(A)))
# Original solution
#!/usr/bin/python3

from fractions import Fraction
import heapq
import math
import sys


DEBUG = False


def inp():
    return sys.stdin.readline().rstrip()


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


def solve(N, M, A):
    hq = [-a for a in A]
    heapq.heapify(hq)
    for _ in range(M):
        v = -hq[0]
        if v < 1:
            break
        v = Fraction(v, 2)
        heapq.heapreplace(hq, -v)

    return sum([math.floor(-v) for v in hq])


def main():
    N, M = [int(e) for e in input().split()]
    A = [int(e) for e in input().split()]
    print(solve(N, M, A))


if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/python3

import heapq
import math
import sys


DEBUG = False


def inp():
    return sys.stdin.readline().rstrip()


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


def solve(N, M, A):
    hq = [-a for a in A]
    heapq.heapify(hq)
    for _ in range(M):
        v = -hq[0]
        if v < 1:
            break
        v //= 2
        heapq.heapreplace(hq, -v)

    return sum([math.floor(-v) for v in hq])


def main():
    N, M = [int(e) for e in input().split()]
    A = [int(e) for e in input().split()]
    print(solve(N, M, A))


if __name__ == '__main__':
    main()
# Original solution
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
A.sort(reverse=True)
j=0
for i in range(M):
    A[A.index(max(A[:j+1]))]=A[A.index(max(A[:j+1]))]//2
    j=j+1
    if j==1000:
        A.sort(reverse=True)    
        j=0
print((sum(A)))

# Optimized solution
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
A.sort(reverse=True)
j=0
for i in range(M):
    A[A.index(max(A[:j+1]))]=A[A.index(max(A[:j+1]))]//2
    j=j+1
    if j==300:
        A.sort(reverse=True)    
        j=0
print((sum(A)))
# Original solution
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
A.sort(reverse=True)
j=0
for i in range(M):
    A[A.index(max(A[:j+1]))]=A[A.index(max(A[:j+1]))]//2
    j=j+1
    if j==250:
        A.sort(reverse=True)    
        j=0
print((sum(A)))

# Optimized solution
import heapq
N,M=list(map(int,input().split()))
A=list([x*(-1) for x in list(map(int,input().split()))])
A.sort()
B=[]
for i in range(N):
    heapq.heappush(B,A[i])
for i in range(M):
    heapq.heappush(B,(((heapq.heappop(B))*(-1))//2)*(-1))
print(((sum(B))*(-1)))
# Original solution
# 毎回ソートしても別にいいんじゃないの -> ダメでした

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

while m > 0:
    arr = list(sorted(arr))
    arr[-1] = arr[-1] // 2
    m -= 1

print((sum(arr)))


# Optimized solution
# 毎回ソートしても別にいいんじゃないの -> ダメでした
# 毎回最大のものがほしいならheapq使うか
import heapq

n, m = list(map(int, input().split()))
# heapは最小のものを取り出すので予め-1をかけて大小を見かけ上逆転しておく
arr = list([int(x) * -1 for x in input().split()])
heapq.heapify(arr)
for _ in range(m):
    a = heapq.heappop(arr)
    # 負数にしたときの誤差がめんどくさい
    a *= -1
    a //= 2
    heapq.heappush(arr, a * -1)
print((sum(arr) * -1))
# Original solution
l = list(map(int, input().split()))
prices = list(map(int, input().split()))

for i in range(l[1]):
    x = prices.index(max(prices))
    prices[x] = int(prices[x] / 2)

print((sum(prices)))


# Optimized solution
import heapq

N, M = list(map(int, input().split()))
values = list(map(int, input().split()))
sortedValues = []

for v in values:
    heapq.heappush(sortedValues, (-1)*v)

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

print(((-1) * sum([heapq.heappop(sortedValues) for i in range(len(sortedValues))])))
# Original solution
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))

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

print((sum(A)))

# Optimized solution
import heapq

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

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

print((-sum(A)))
# Original solution
import heapq as hq
import math

def discount(price):
    return math.ceil(price / 2)

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

for _ in range(M):
    a = discount(hq.heappop(A))
    hq.heappush(A,a)

print((sum(A)* -1))

# Optimized solution
import heapq as hq
import math

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

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

print((sum(A)* -1))
# Original solution
from collections import deque
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
q = deque(a)

count_use = 0
while count_use < m:
    max_a = a.pop()
    max_a = max_a//2
    a.append(max_a)
    a.sort()
    count_use += 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)

count_use = 0
while count_use < m:
    max_a = heapq.heappop(a)
    max_a = -1*((-1*max_a)//2)
    #print(max_a)
    heapq.heappush(a, max_a)
    count_use += 1

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

if N == 1:
    print((A[0]//(2**M)))
else:
    for i in range(M):
        A[0] = A[0]//2
        j = 0
        while(A[j]<A[j+1]):
            t = A[j]
            A[j] = A[j+1]
            A[j+1] = t
            j += 1
            if j == N-1:
                break
    print((sum(A)))

# Optimized solution
import sys

N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
A.sort(reverse=True)
m = A[0]
seg = [1]

t = 1
while(True):
    t *= 2
    if t > m:
        break
    seg.append(t)

c = 0
for i in range(-1,-len(seg)-1,-1):
    for j in range(N):
        if A[j] < seg[i]:
            break
        A[j] = A[j]//2
        c += 1
        if c == M:
            print((sum(A)))
            sys.exit()
    A.sort(reverse=True)

print((sum(A)))
# Original solution
n, m = (int(x) for x in input().split())
a = [int(x) for x in input().split()]
for _ in range(m):
    idx = a.index(max(a))
    a[idx] //= 2
print((sum(a)))

# Optimized solution
import heapq as hp
n, m = (int(x) for x in input().split())
a = [int(x)*(-1) for x in input().split()]
hp.heapify(a)
for _ in range(m):
    min = hp.heappop(a)
    hp.heappush(a, (-1)*(-min//2))
print((-sum(a)))
# 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

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

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(n) :
  a[i] *= -1

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

print((sum(a)*-1))
# Original solution
# -*- coding: utf-8 -*-
import heapq


num_product, num_coupon = [int(s) for s in input().split()]
price_list = []
for s in input().split():
  heapq.heappush(price_list, int(s))

for i in range(num_coupon):
  max_price = max(price_list)
  for j in range(len(price_list)):
    if price_list[j] == max_price:
      price_list[j] //= 2
      break

sum = 0
for price in price_list:
  sum += price

print(sum)

# Optimized solution
# -*- coding: utf-8 -*-
import heapq

num_product, num_coupon = [int(s) for s in input().split()]
price_list = []
for s in input().split():
  heapq.heappush(price_list, int(s)*-1)

for i in range(num_coupon):
  min = price_list[0]
  heapq.heapreplace(price_list, (min*-1//2)*-1)

sum = 0
for price in price_list:
  sum -= price

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

# Optimized solution
'''
標準入力
4 4
1 9 3 5
'''

n,m=list(map(int, input().split()))
a=list(map(int, input().split()))
b=[-a[i] for i in range(n)]
#print(b) => [-1, -9, -3, -5]

import heapq
heapq.heapify(b)
#print(b) => [-9, -5, -3, -1]

for i in range(m):
	maximum=heapq.heappop(b)
#forなしでprint(maximum) => -9
	
	maximum=-(-maximum//2)
	heapq.heappush(b,maximum)
print(((sum(b))*(-1)))
# Original solution
import sys
input = sys.stdin.readline

n,m = list(map(int, input().split(' ')))
a_list = list(map(int, input().split(' ')))
 
for i in range(m):
    p = max(a_list)
    a_list.remove(p)
    a_list.append(p // 2)
    
print((sum(a_list)))

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

n,m = list(map(int, input().split(' ')))
a_list = [-1 * int(i) for i in input().split() ]
heapq.heapify(a_list)
 
for _ in range(m):
    p = heapq.heappop(a_list)
    q = (-1*p //2) * (-1)
    heapq.heappush(a_list, q)    
    
print((-sum(a_list)))
# Original solution
import sys
input = sys.stdin.readline
import heapq

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

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

print((-sum(a)))


# Optimized solution
import sys
input = sys.stdin.readline
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 i in range(m):
    c=-(-heapq.heappop(a)//2)
    heapq.heappush(a,c)
#print(a)
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))]=A[A.index(max(A))]//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 sys
from bisect import bisect_left,bisect

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
n,m=list(map(int,input().split()))



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

if len(A)>10**5:
	Al=A[-10**5:]
	Af=A[:-10**5]
	for i in range(m):
		Al.insert(bisect_left(Al,max(Al)//2),max(Al)//2)
		del Al[n]
	print((sum(Al)+sum(Af)))
	
else:
	for i in range(m):
		A.insert(bisect_left(A,max(A)//2),max(A)//2)
		del A[n]
	
	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):
    minimum=heapq.heappop(a)
    mini=((minimum*(-1))//2)*(-1)
    heapq.heappush(a,mini)
    
print((-sum(a)))
# Original solution
import bisect


N,M=list(map(int,input().split()))
la=list(map(int,input().split()))
la.sort()
for i in range(M):
    #la.sort()
    #la[N-1]/=2
    ll=la[N-1]/2
    la.pop()
    #la.insert(nibutan(0,N-2,la,ll),ll)
    bisect.insort_left(la,ll,0,N-1)

ans=0
for i in range(N):
    ans+=int(la[i])
print(ans)


# Optimized solution
import heapq
N,M=list(map(int,input().split()))
la=list([-int(x) for x in input().split()])
heapq.heapify(la)
#la.sort()
for i in range(M):
    ll=heapq.heappop(la)/2
    heapq.heappush(la,ll)
ans=0
for i in range(N):
    ans+=int(-heapq.heappop(la))
print(ans)
# Original solution
import sys
import heapq


def input():
    return sys.stdin.readline().rstrip()


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

    for i in range(M):
        maxaa = -1 * heapq.heappop(AA)
        if max(A) == 0:
            print("0")
            exit()
        heapq.heappush(AA,  maxaa // 2 * (-1))
    print((sum(AA) * (-1)))


if __name__ == '__main__':
    main()


# Optimized solution
import sys
import heapq


def input():
    return sys.stdin.readline().rstrip()


def main():
    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):
        maxa = -1 * heapq.heappop(A)
        if maxa == 0:
            print("0")
            exit()
        heapq.heappush(A,  maxa // 2 * (-1))
    print((sum(A) * (-1)))


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

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

print((sum(lst)))



# Optimized solution
import heapq

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

heapq.heapify(lst)
 
for i in range(M):
    lstmin = heapq.heappop(lst)
    b = (-(lstmin) // 2)
    heapq.heappush(lst,-b)
    
print((-sum(lst)))
# Original solution
import heapq

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

heapq.heapify(prod)

for _ in range(m):
    a = heapq.heappop(prod)*(-1)

    a = a//2

    heapq.heappush(prod,(-1)*a)


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

print((sum(ans)))

# 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,math

heapq.heapify(a)

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

    heapq.heappush(a,b*(-1))

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

for x 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 = sorted(list(map(int, input().split())), reverse=True)
A = list([x * (-1) for x in A])
heapq.heapify(A)

for x in range(M):
    maxA = heapq.heappop(A)
    heapq.heappush(A, -1 * ((-1 * maxA) // 2))
A = list([x * (-1) for x in A])

print((sum(A)))
# Original solution
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
for i in range(0,M):
    m=max(A)
    index=A.index(m)
    A[index]=m//2
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(0,N)]
heapq.heapify(A)
for i in range(0,M):
    m=(-1)*heapq.heappop(A)
    m=m//2
    m=-m
    heapq.heappush(A,m)
print(((-1)*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))] = 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):
    heapq.heappush(A,-(-heapq.heappop(A)//2))
                   
print((-sum(A)))
# Original solution
import heapq
import math

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

for i in range(n):
    heapq.heappush(q, -a[i])

for _ in range(m):
    b = heapq.heappop(q) / 2
    heapq.heappush(q, math.ceil(b))

print((sum(q) * -1))


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

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, m = list(map(int, input().split()))
    A = list([int(x) * (-1) for x in input().split()])
    heapify(A)
    for _ in range(m):
        a = (heappop(A) * (-1)) // 2
        heappush(A, a * (-1))

    print((sum(A) * (-1)))


if __name__ == '__main__':
    resolve()
# Original solution
n,m = list(map(int,input().split()))
a =list(map(int,input().split()))
b = sorted(a,reverse=True)


for i in range(m):
    max_b = b[0]
    b.pop(0)
    b.append(max_b//2)
    b = sorted(b,reverse = True)
print((sum(b)))

# Optimized solution
# -*- coding: utf-8 -*-
import heapq

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

# solve
ans = [-a for a in A]
heapq.heapify(ans)
for i in range(M):
    tmp = heapq.heappop(ans) * (-1) // 2
    heapq.heappush(ans, tmp * (-1))
ans = [-a for a in ans]

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

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


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

while M > 0:
    A.sort(reverse=True)
    if A[0] == 0:
        break
    ham = A[0] // 2
    for i, a in enumerate(A):
        if ham < a and M > 0:
            A[i] = A[i] // 2
            M -= 1
        else:
            break
print((sum(A)))
# Original solution
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))

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


ans = 0

for i in A:
    ans += int(i)

print(ans)


# Optimized solution
import heapq

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

B = []

for i in A:
    B.append(-i)

heapq.heapify(B)

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

print((-sum(B)))
# Original solution
from collections import deque

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

A = deque(sorted(A, reverse=True))
for _ in range(M):
  x = A.popleft()//2
  for i, a in enumerate(A):
    if x >= a:
      A.insert(i, x)
      break
  else:
    A.append(x) 
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):
  heapq.heappush(A, (-((-heapq.heappop(A))//2)))
print((-sum(A)))
# Original solution
import heapq as hq
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
def heapSort(i):
    h = []
    for v in i:
        hq.heappush(h, v)
    return [hq.heappop(h) for i in range(len(h))]
for i in range(m):
    a = heapSort(a)
    a[n-1] //= 2
print((sum(a)))

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