CodeEff/ECCO huggingface dataset:
# Original solution
import bisect

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

list.sort(A)  # 昇順にソート

for i in range(M):
    A[N-1] = A[N-1] // 2
    tmp = A[N-1]
    del A[N-1]
    insert_index = bisect.bisect_left(A, tmp)
    A.insert(insert_index, tmp)
    
print((sum(A)))

# Optimized solution
import heapq

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

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

for i in range(M):
    tmp = heapq.heappop(hq) * (-1) // 2
    heapq.heappush(hq, tmp*(-1))
    
print((sum(hq)*(-1)))
# Original solution
x,y=list(map(int, input().split()))
z=list(map(int, input().split()))
t=0
for i in range(y):
	t=z.index(max(z))
	z[t]=z[t]//2
print((sum(z)))

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

# Optimized solution
import heapq

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

heapq.heapify(A)
for _ in range(M):
#Hは全部マイナスをつけたからaは最大値的なのはいる
    a = heapq.heappop(A)
    heapq.heappush(A, int(a/2))
print((-sum(A)))

# 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.heapreplace(A, int(A[0]/2))
print((-sum(A)))
# Original solution
from sys import stdin

s=stdin.readline().rstrip().split()
N=int(s[0])
M=int(s[1])
count=0

a=stdin.readline().rstrip().split()
for i in range(N):
  a[i]=int(a[i])

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

print((sum(a)))


# Optimized solution
from sys import stdin
import heapq

s=stdin.readline().rstrip().split()
N=int(s[0])
M=int(s[1])

a=stdin.readline().rstrip().split()
for i in range(N):
  a[i]=int(a[i])*(-1)
  
heapq.heapify(a)
for i in range(M):
  t=-(-heapq.heappop(a)//2)
  heapq.heappush(a,t)
print((sum(a)*(-1)))
# Original solution
import math

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


def solve():
    sorted_list = A

    for index in range(0, M):
        sorted_list = sorted(sorted_list)
        sorted_list[-1] = math.floor(sorted_list[-1] / 2)

    return sum(sorted_list)


print((solve()))


# Optimized solution
import heapq

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


def solve():
    AA = [[-x, x] for x in A]

    heapq.heapify(AA)

    for i in range(M):
        x, y = heapq.heappop(AA)
        heapq.heappush(AA, [-(y//2), y//2])

    AAA = [x[1] for x in AA]
    return sum(AAA)


print((solve()))
# Original solution
import bisect
import sys
input = sys.stdin.readline
n,m=list(map(int,input().split()))
a=[int(i) for i in input().split()]
a.sort()

for _ in range(m):
    b=a[-1]
    a.pop()
    bisect.insort(a,b/2)
print((sum( int( i//1) 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):
    b=-heapq.heappop(a)
    heapq.heappush(a,-b/2)
print((int( sum(-i//1 for i in a)) ))
# Original 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):
    b=-heapq.heappop(a)
    heapq.heappush(a,-b/2)
print((int( sum(-i//1 for i in a)) ))

# Optimized solution

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

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

a = list(map(int, input().split()))
for i in range(M):
    k = a.index(max(a))
    a[k] //= 2

print((sum(a)))

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

a = list([-int(x) for x in input().split()])
heapq.heapify(a)

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

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

def price(x):
    return x // 2


for i in range(m):
    x = a.pop()
    a.append(price(x))
    a.sort()

print((sum(a)))

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

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

ans = -sum(price)
print(ans)
# Original solution
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort(reverse=True)
for j in range(m):
  if len(a) != 1:
    if a[0] >= a[1]:
      a[0] //= 2
    else:
      a[1] //= 2
      a.sort(reverse=True)
  else:
    a[0] //= 2
print((sum(a)))

# Optimized solution
n, m = list(map(int, input().split()))
a = [int(i) for i in input().split()]
a.sort(reverse=True)

if n > 1:
    a.append(0)
    biggest = a[0]
    now = 0
    while m > 0:
        a[now] = a[now]//2
        m -= 1
        biggest = a[0]
        for i in range(n-1):
            if a[i+1] >= biggest and m > 0:
                a[i+1] = a[i+1]//2
                m -= 1
            else:
                a.sort(reverse=True)
                break
    else:
        quit

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

print((sum(a)))
# Original solution
import bisect
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
for i in range(m):
    nex_num = a[-1] // 2
    del a[-1]
    a.insert(bisect.bisect_left(a, nex_num), nex_num)
print((sum(a)))

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

while m != 0:
    price[0] //= 2
    for i in range(1,n):
        if price[0] > price[i]:
            price_buf = price[1:i]
            price[i-1] = price[0]
            price[0:i-1] = price_buf
            break
    m -= 1
print((sum(price)))


# Optimized solution
import heapq

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

n, m = list(map(int, input().split()))
a = []
#a = list(map(int, input().split()))
#a = list(reversed(sorted(a)))
#heapq.heapify(a)
for i in input().split():
    heapq.heappush(a, -int(i))

ans = 0

for i in range(len(a)):
    while True:
        if m <= 0:
            break

        maxV = heapq.heappop(a)
#        print('maxV: ' + str(maxV))
        heapq.heappush(a, -(-maxV // 2))
        m -= 1
        # print('m: ' + str(m))
        # print('a: ' + str(a))
ans = -sum(a)
print(ans)


# Optimized solution
import heapq

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
import math
import bisect

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

for i in range(M):
    n = A.pop() // 2
    bisect.insort(A, n)
    
for j in range(N):
    A[j] = math.floor(A[j])

print((sum(A)))

# Optimized solution
from heapq import heapify, heappop, heappush

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

for i in range(M):
    n = -heappop(A_minus) // 2
    heappush(A_minus, -n)

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

print(yen)

# Optimized solution
import sys
import math
from collections import deque
import heapq

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(eval(input()))
NMI = lambda: list(map(int, input().split()))
NLI = lambda: list(NMI())
SI = lambda: eval(input())


def main():
    N, M = NMI()
    A = NLI()
    A = [-a for a in A]
    heapq.heapify(A)
    for i in range(M):
        a_max = -heapq.heappop(A)
        a_max = a_max // 2
        heapq.heappush(A, -a_max)
    print((-sum(A)))



if __name__ == "__main__":
    main()
# Original solution
def main():
    import sys
    import heapq
    input=sys.stdin.readline
    N,M=list(map(int,input().split()))
    A=list([-1*int(x) for x in input().split()])
    for i in range(M):
        heapq.heapify(A)
        if i==0:
            temp = -(heapq.heappop(A))//2
        else:
            heapq.heappush(A,-temp)
            temp = -(heapq.heappop(A))//2
    print((-sum(A)+temp))
    
if __name__ == '__main__':
    main()

# Optimized solution
def main():
    import sys
    import heapq
    input=sys.stdin.readline
    N,M=list(map(int,input().split()))
    A=list([-1*int(x) for x in input().split()])
    heapq.heapify(A)
    for i in range(M):
        if i==0:
            temp = -(heapq.heappop(A))//2
        else:
            heapq.heappush(A,-temp)
            temp = -(heapq.heappop(A))//2
    print((-sum(A)+temp))
    
if __name__ == '__main__':
    main()
# Original solution
import math

n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
a = sorted(A, reverse = True)
cnt = 0
ans = 0
while cnt < m:
    max_a = max(a)
    for i in range(n):
        if cnt == m:
            break
        if a[i] == max_a:
            cnt += 1
            a[i] = a[i]/2
for j in a:
    ans += math.floor(j)

print(ans)

# Optimized solution
import heapq, math

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):
    max_a = heapq.heappop(a)
    heapq.heappush(a, math.ceil(max_a/2))
print((-sum(a)))
# Original solution
# 優先度付キューのimport
import heapq

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

a = [int(i) * -1 for i in input().split()]

heapq.heapify(a)

for i in range(m):
    minPrice = heapq.heappop(a)
    # 負の切捨てが面倒なので正の値にしてからまた負に戻す
    minPrice = -(abs(minPrice) // 2)
    heapq.heappush(a, minPrice)

sum = 0
for i in a:
    sum += -i

print(sum)

# Optimized solution
# 優先度付キューのimport
import heapq

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

a = [int(i) * -1 for i in input().split()]

heapq.heapify(a)

for i in range(m):
    minPrice = heapq.heappop(a)
    # 負の切捨てが面倒なので正の値にしてからまた負に戻す
    minPrice = -(abs(minPrice) // 2)
    heapq.heappush(a, minPrice)

print((-sum(a)))
# Original solution
import math

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

# 以下を割引券の枚数分繰り返す
# 品物の値段を高い順にソート
# 最も高い品物に割引券を1枚使う
for i in range(M):
	A.sort(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)

# 以下を割引券の枚数分繰り返す
# 最も高い品物に割引券を1枚使う
for _ in range(M):
	min = heapq.heappop(A)
	heapq.heappush(A, (-1) * (-min // 2))

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

n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
d = {}
for i in range(n):
  if a[i] in d:
    l = d[a[i]]
    l.append(i)
    d[a[i]] = l    
  else:
    d[a[i]] = [i]

for i in range(m):
  b = max(a)
  li = d[b]
  li0 = li.pop(0)
  d[b] = li
  a[li0] = b/2
  if b/2 in d:
    l = d[b/2]
    l.append(li0)
    d[b/2] = l
  else:
    d[b/2] = [li0]

ans = 0
for i in a:
  ans += math.floor(i)
print(ans)

# Optimized solution
import math
import heapq

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

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

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

ans = 0
for i in hq:
  ans += i *(-1)
print(ans)
# Original solution
from sys import stdin
from bisect import insort


def main():
    N, M = [int(x) for x in stdin.readline().rstrip().split()]
    As = [int(x) for x in stdin.readline().rstrip().split()]
    As.sort()
    for _ in range(M):
        x = As[-1] / 2
        insort(As, x)
        del As[-1]
    sum_ = 0
    for x in As:
        sum_ += int(x)
    print(sum_)


if __name__ == "__main__":
    main()


# Optimized solution
from sys import stdin
import heapq


def main():
    N, M = [int(x) for x in stdin.readline().rstrip().split()]
    As = []
    for i in [int(x) for x in stdin.readline().rstrip().split()]:
        heapq.heappush(As, -i)
    for _ in range(M):
        x = heapq.heappop(As)
        heapq.heappush(As, x / 2)
    print((sum([-1 * int(x) for x in As])))


if __name__ == "__main__":
    main()
# Original solution
from sys import stdin
import heapq


def main():
    N, M = [int(x) for x in stdin.readline().rstrip().split()]
    As = []
    for i in [int(x) for x in stdin.readline().rstrip().split()]:
        heapq.heappush(As, -i)
    for _ in range(M):
        x = heapq.heappop(As)
        heapq.heappush(As, x / 2)
    print((sum([-1 * int(x) for x in As])))


if __name__ == "__main__":
    main()


# Optimized solution
from sys import stdin
import heapq


def main():
    N, M = [int(x) for x in stdin.readline().rstrip().split()]
    As = []
    for i in [int(x) for x in stdin.readline().rstrip().split()]:
        heapq.heappush(As, -i)
    for _ in range(M):
        x = heapq.heappop(As)
        heapq.heappush(As, -(-x // 2))
    print((sum([-1 * x for x in As])))


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

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

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):
  tmp = -((-heapq.heappop(A))//2)
  heapq.heappush(A, tmp)

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

for i in range(N[1]):
    for Index, Kakaku in enumerate(A):
        if Kakaku == max(A):
            A[Index] = int(Kakaku / 2)
            break

print((sum(A)))


# Optimized solution
import heapq

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

heapq.heapify(A)
for i in range(N[1]):
    heapq.heappush(A, int(heapq.heappop(A) / 2))

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

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

heapq.heapify(A)
for i in range(N[1]):
    heapq.heappush(A, int(heapq.heappop(A) / 2))

print((-sum(A)))

# Optimized solution
import heapq
 
def FUNCTION(A, M):
    heapq.heapify(A)
    for i in range(M):
        heapq.heappush(A, int(heapq.heappop(A) / 2))
    return -sum(A)

N = list(map(int, (input().split(' '))))
A = list([x*(-1) for x in list(map(int, (input().split(' '))))])
print((FUNCTION(A, N[1])))
# Original solution
N, M = list(map(int, input().split())) 
Alist = list(map(int, input().split()))

# Alistの値段の高いモノから割引券を使った方がよい
while M > 0:
    max_index = Alist.index(max(Alist))
    Alist[max_index] = Alist[max_index]//2
    M = M - 1
print((sum(Alist)))

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

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

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

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

h = [(-a, a) for a in aa]
heapq.heapify(h)
for _ in range(m):
    x = h[0]
    c = x[1] // 2
    x = (-c, c)

    heapq.heapreplace(h, x)

print((sum([-hh[0] for hh in h])))

# Optimized solution
import heapq

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

h = [-a for a in aa]
heapq.heapify(h)
for _ in range(m):
    x = h[0]
    heapq.heapreplace(h, -(-x // 2))

print((sum([-hh for hh in h])))
# Original solution
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
a.sort()

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

print((sum(a)*(-1)))
# Original solution
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
ts=time.time()
sys.setrecursionlimit(10**6)
#input=sys.stdin.readline
show_flg=False
show_flg=True

an=0
n,m=MI()
a=LI()
q=[]
for i in a:
    heappush(q,-i)

for i in range(m):
    x=-heappop(q)
    x//=2
    heappush(q,-x)
print(-sum(q))


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

while m>0:
  A.sort(reverse=True)
  A[0]=A[0]//2
  m-=1
print((sum(A)))

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

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

# Optimized solution
from heapq import heapify, heappush, heappop
N, M = list(map(int, input().split()))
A = [-int(i) for i in input().split()]
heapify(A)
while M > 0:
    heappush(A, heappop(A) / 2)
    M -= 1
print((-sum(int(i) for i in A)))
# Original solution
def pushHeap(array, elem):
    n = len(array)
    array.append(elem)
    while n != 0:
        i = int((n - 1) / 2)
        if array[n] > array[i]:
            tmp = array[n]
            array[n] = array[i]
            array[i] = tmp
        n = i


def popHeap(array):
    n = len(array) - 1
    array[0] = array[n]
    del array[-1]
    i = 0
    while 2 * i + 1 < n:
        j = 2 * i + 1
        if j != n - 1 and array[j] < array[j + 1]:
            j += 1
        if array[i] < array[j]:
            tmp = array[j]
            array[j] = array[i]
            array[i] = tmp
        i = j


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

for a in A:
    pushHeap(heap_A, a)

for _ in range(M):
    discount_max = int(heap_A[0] / 2)
    popHeap(heap_A)
    pushHeap(heap_A, discount_max)

print((sum(heap_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):
    a_min = heapq.heappop(A)
    heapq.heappush(A, -1 * (-a_min//2))

print((-sum(A)))
# 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[0]=a[0]/2
  for j in range(1,n):
    if a[0]>a[j]:
      a.insert(j,a[0])
      del a[0]
      break
import math
ans=0
for i in range(n):
  ans=ans+math.floor(a[i])
print(ans)

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

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

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

print((-sum(hq)))    


# Optimized solution
from heapq import heappush, heappop, heapify

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

heapify(hq)

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

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

N,M = list(map(int, input().split()))
hq = []
for i in input().split():
    heappush(hq, -int(i))

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

print((-sum(hq)))    


# Optimized solution
from heapq import heappush, heappop, heapify

def main():
    N,M = list(map(int, input().split()))
    hq = [-int(i) for i in input().split()]

    heapify(hq)

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

    print((-sum(hq)))    

if __name__ == "__main__":
    main()
# Original solution
import heapq
# import collection
# import bisect
# import numpy

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

# N = 10**5
# A = [10 for i in range(10**5)]
# M = 10**5

# A = sorted(A)

heapq.heapify(A)

while M > 0:
    i = heapq.nlargest(1, enumerate(A), key=lambda x: x[1])
    A[i[0][0]] = A[i[0][0]] // 2
    M -= 1

print((sum(A)))


# Optimized solution
import heapq
# import collection
# import bisect
# import numpy

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

# N = 10**5
# A = [10 for i in range(10**5)]
# M = 10**5

# A = sorted(A)
A = []
for i in input().split():
    heapq.heappush(A, -int(i))

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

print((-sum(A)))
# Original solution
import heapq
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
A = [-A[i] for i in range(N)]
A = sorted(A)
cnt = 0
while cnt<M:
    a = heapq.heappop(A)*(-1)
    a = a/2
    heapq.heappush(A,-a)
    cnt += 1
A = [int(-A[i]) for i in range(N)]
print((sum(A)))

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

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

# Optimized solution
import heapq

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