CodeEff/ECCO huggingface dataset:
# Original solution
# ABC141D - Powerful Discount Tickets
from heapq import heapify, heappop, heappush


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

    heappop_max = lambda heap: -heappop(heap)
    heappush_max = lambda heap, x: heappush(heap, -x)
    discount = lambda: heappush_max(A, heappop_max(A) // 2)

    for _ in range(M):
        discount()
    print((-sum(A)))


if __name__ == "__main__":
    main()


# Optimized solution
# ABC141D - Powerful Discount Tickets
from heapq import heapify, heappop, heappush


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

    discount = lambda: heappush(A, -(-heappop(A) // 2))
    for _ in range(M):
        discount()

    print((-sum(A)))


if __name__ == "__main__":
    main()
# Original solution
import heapq
N,M = list(map(int,input().split()))
Alist = list(map(int,input().split()))
newA = list([x*(-1) for x in Alist])
for i in range(M):
    heapq.heapify(newA)
    current = -heapq.heappop(newA)
    heapq.heappush(newA,-(current//2))

cost = 0
for i in range(N):
    cost += newA[i]
print((-cost))

# Optimized solution
import heapq
N,M = list(map(int,input().split()))
Alist = list(map(int,input().split()))
newA = list([x*(-1) for x in Alist])
heapq.heapify(newA)
for i in range(M):
    current = -heapq.heappop(newA)
    heapq.heappush(newA,-(current//2))
cost = 0
print((-sum(newA)))
# Original solution
#!/usr/bin/env python
# coding: utf-8

# In[12]:


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


# In[13]:


for m in range(M):
    idx = A.index(max(A))
    A[idx] /= 2
ans = sum([x//1 for x in A])
print((int(ans)))


# In[ ]:






# Optimized solution
#!/usr/bin/env python
# coding: utf-8

# In[18]:


import heapq


# In[23]:


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


# In[24]:


heapq.heapify(A)
for m in range(M):
    tmp = heapq.heappop(A)
    heapq.heappush(A, -(-tmp//2))
print((-sum(A)))
# Original solution
import sys
from bisect import insort_right
input = sys.stdin.readline
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
for i in range(M):
  tmp = A[-1-i]
  insort_right(A,tmp//2)
print((sum(A[:-M])))

# Optimized solution
import sys
import heapq
from bisect import insort_right
input = sys.stdin.readline
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A = [-a for a in A]
heapq.heapify(A)
  
for i in range(M):
  tmp = heapq.heappop(A)
  heapq.heappush(A,int(tmp/2))
print((sum([-a for a in A])))
# Original solution
import sys
import heapq
from bisect import insort_right
input = sys.stdin.readline
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A = [-a for a in A]
heapq.heapify(A)
  
for i in range(M):
  tmp = heapq.heappop(A)
  heapq.heappush(A,int(tmp/2))
print((sum([-a for a in A])))

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

print((-sum(A)))
# Original solution
#atcorder beginner contest 141
#D powerful discount tickets
import math

goods, tickets = input().split()
goods = int(goods)
tickets = int(tickets)

price = []
total = 0

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

for i in range(tickets):
    max_index = price.index(max(price))
    max_price = math.floor(max(price) / 2)
    price[max_index] = max_price


for i in range(goods):
    total += price[i]

print(total)

# Optimized solution
#atcorder beginner contest 141
#D powerful discount tickets
import math
import heapq

goods, tickets = list(map(int, input().split()))

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


for i in range(tickets):
    max = heapq.heappop(price) * (-1)
    heapq.heappush(price, math.ceil(-max/2))
   

total = 0
for i in range(goods):
    total += price[i]

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

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

for discount_i in range(m):
  max_item = max(item_list)
  target_index = item_list.index(max_item)
  item_list[target_index] = item_list[target_index]//2
  
print((sum(item_list)))

# Optimized solution
import heapq

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

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

for discount_i in range(m):
  target = -1*(-1*heapq.heappop(item_list)//2)
  heapq.heappush(item_list, target)

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

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

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

while M>0:
    max_a = heapq.heappop(A)
    heapq.heappush(A,-int(-max_a/2))
    M = M-1
print((-sum(A)))
# Original solution
import math
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
a.sort()
for i in range(m):
  c=math.floor(a[-1]/2)
  a[-1]=c
  a.sort()
 
sum=0
for i in range(n):
  sum+=a[i]
  
print(sum)
  


# Optimized solution
from heapq import heapify, heappop, heappush

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

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

print((-1*sum(A)))
# Original solution
import math
n, m = list(map(int, input().split()))
a = [int(i) for i in input().split()]
b = [[math.log(aa, 2), i] for i, aa in enumerate(a)]

for i in range(m):
    a[max(b)[1]] = int((max(a) / 2) // 1)
    b[max(b)[1]][0] -= 1
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 i in range(m):
    k = heapq.heappop(a)
    heapq.heappush(a, -int(-(k / 2) // 1))
print((-sum(a)))
# 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[-(i+1)]//2
    bisect.insort(a,x)
print((sum(a[:n])))

# Optimized solution
import heapq

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

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

# Optimized solution
from heapq import heappush, heappop

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

print((-sum(a)))

# Optimized solution
from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))
from heapq import *

n,m=nii()
a=lnii()
a=[-i for i in a]
a.sort(reverse=True)

heapify(a)

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

print((-sum(a)))
# Original solution
#!/usr/bin/env python3

from bisect import insort_right
from collections import deque

n, m, *a = list(map(int, open(0).read().split()))

a = deque(sorted(a))
for _ in range(m):
    insort_right(a, a.pop() >> 1)
print((sum(a)))


# Optimized solution
#!/usr/bin/env python3

from bisect import insort_right

n, m, *a = list(map(int, open(0).read().split()))
a.sort()
for _ in range(m):
    insort_right(a, a.pop() >> 1)
print((sum(a)))
# Original solution
#!/usr/bin/env python3

from bisect import insort_right

n, m, *a = list(map(int, open(0).read().split()))
a.sort()
for _ in range(m):
    insort_right(a, a.pop() >> 1)
print((sum(a)))


# Optimized solution
#!/usr/bin/env python3

import heapq

n, m, *a = list(map(int, open(0).read().split()))

a = [*[-x for x in a]]
heapq.heapify(a)
for _ in range(m):
    heapq.heappush(a, -(-heapq.heappop(a) >> 1))
print((-sum(a)))
# Original solution
import math
import heapq

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

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

amount = 0
for a in A:
  amount += math.floor(-a)
print(amount)

# Optimized solution
import heapq
import math

mnum, gnum = list(map(int, input().split()))
array = list([-int(a) for a in input().split()])

array.sort()
heapq.heapify(array)

for i in range(gnum):
	temp = heapq.heappop(array)
	temp /= 2.0
	heapq.heappush(array, temp)
    
amount = 0
for a in array:
  amount += math.floor(-a)
print(amount)
# Original solution
import bisect

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

a = sorted(a)

for i in range(m):
    a[n-1] = a[n-1] // 2
    temp = a.pop()
    bisect.insort_left(a, temp)
print((sum(a)))

# Optimized solution
import heapq

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

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

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

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


for _ in range(m):
  a = A.pop() // 2
  A.insert(bisect.bisect_left(A,a),a)
print((sum(A)))

# Optimized solution
import bisect
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):
  a = -heapq.heappop(A)//2
  heapq.heappush(A,-a)
print((-sum(A)))
# Original solution
# -*- coding: utf-8 -*-
# abc141/abc141_d
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, M = i2nn()
    A = i2nn()
    A2 = sorted(A, reverse=True)
    for _ in range(M):
        discount(A2, N)
    print((sum(A2)))
    return

def discount(A, N):
    A[0] = A[0] >> 1
    for i in range(N - 1):
        if A[i] < A[i+1]:
            A[i], A[i+1] = A[i+1], A[i]
        else:
            break
    # print(A)

main()


# Optimized solution
# -*- coding: utf-8 -*-
# abc141/abc141_d
import sys
import heapq

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, M = i2nn()
    h = [-int(s) for s in sys.stdin.readline().rstrip().split()]
    heapq.heapify(h)
    for _ in range(M):
        top_h = -(-h[0] // 2)
        heapq.heapreplace(h, top_h)
    print((-sum(h)))

main()
# Original solution
# -*- coding: utf-8 -*-
# abc141/abc141_d
import sys
import heapq

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, M = i2nn()
    h = [-int(s) for s in sys.stdin.readline().rstrip().split()]
    heapq.heapify(h)
    for _ in range(M):
        top_h = -(-h[0] // 2)
        heapq.heapreplace(h, top_h)
    print((-sum(h)))

main()


# Optimized solution
# -*- coding: utf-8 -*-
# abc141/abc141_d
import sys
import heapq

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, M = i2nn()
    h = [-int(s) for s in sys.stdin.readline().rstrip().split()]
    heapq.heapify(h)
    for _ in range(M):
        heapq.heapreplace(h, -(-h[0] // 2))
    print((-sum(h)))

main()
# Original solution
import bisect
from collections import deque
import sys

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

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

    for _ in range(M):
        max_value = que.pop()
        bisect.insort_right(que,max_value // 2)

    print((sum(que)))

if __name__ == "__main__":
    main()

# Optimized solution
import heapq
import sys

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

def main():
    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):
        max_value = heapq.heappop(A) * (-1)
        heapq.heappush(A,max_value//2 * (-1))

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

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

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

if n == 1:
    while m > 0:
        a[0] //= 2
        m -= 1
    print((a[0]))
    exit()

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


# Optimized solution
n, m = list(map(int, input().split()))
a = sorted(list(map(int, input().split())), reverse=True)

if n == 1:
    while m > 0:
        a[0] //= 2
        m -= 1
    print((a[0]))
    exit()

while m > 0:
    a.sort(reverse = True)
    mid = a[0] // 2
    i = 0
    while a[i] >= mid:
        if m > 0:
            a[i] //= 2
            m -= 1
            i += 1
        else:
            break
        if i == len(a):
            break
print((sum(a)))
# Original solution
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
ans=0
while M!=0:
  val=max(A)
  index=A.index(val)
  A[index]//=2
  M-=1
print((sum(A)))

# Optimized solution
import heapq
N,M=list(map(int,input().split()))
lst=list(map(int,input().split()))
A=[]
for i in range(N):
  heapq.heappush(A,-1*lst[i])
while M!=0:
  val=heapq.heappop(A)
  M-=1
  new_val=val/2
  heapq.heappush(A,new_val)

ans=0
for i in range(N):
  ans+=-1*int(A[i])
print(ans)
# Original solution
import heapq
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
q=[]
for i in range(n):
  q.append((-1)*a[i])
for k in range(m):
  heapq.heapify(q)
  ma=heapq.heappop(q)
  if ma%2==0:
    heapq.heappush(q,ma//2)
  else:
    heapq.heappush(q,ma//2+1)
print((sum(q)*(-1)))

# Optimized solution
import heapq
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
q=[]
for i in range(n):
  q.append((-1)*a[i])
heapq.heapify(q)
for k in range(m):
  ma=heapq.heappop(q)
  if ma%2==0:
    heapq.heappush(q,ma//2)
  else:
    heapq.heappush(q,ma//2+1)
print((sum(q)*(-1)))
# Original solution
N,M = [int(i) for i in input().split()]
data = [int(i) for i in input().split()]
data.sort(reverse = True)
#print(data)
while M != 0:
    x = max(data)
    data[data.index(x)] //= 2
    M -= 1
    #print(data)

print((sum(data)))

# Optimized solution
import heapq


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

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


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

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

heapq.heapify(b)
for i in range(m):
    h = heapq.heappop(b)
    heapq.heappush(b, math.ceil(h / 2))

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

print((sum(c)))


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

heapq.heapify(b)
for i in range(m):
    h = heapq.heappop(b)
    heapq.heappush(b, math.ceil(h / 2))

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

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

def heapsort(iterable):
    h = []
    for value in iterable:
        heapq.heappush(h, value)
    return [heapq.heappop(h) for i in range(len(h))]

for i in range(m):
    m -= 0
    a = heapsort(a)
    a[-1] = a[-1] // 2

print((sum(a)))

"""
for i in range(m):
    a.sort()
    a.reverse()
    m -= 1
    a[0] = a[0] // 2

print(sum(a))
"""


# Optimized solution
import heapq

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

heapq.heapify(a)

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

print((-sum(a)))

"""
for i in range(m):
    a.sort()
    a.reverse()
    m -= 1
    a[0] = a[0] // 2

print(sum(a))
"""
"""
def heapsort(iterable):
    h = []
    for value in iterable:
        heapq.heappush(h, value)
    return [heapq.heappop(h) for i in range(len(h))]
"""
# Original solution
N,M = list(map(int,input().split()))
A=[int(n) for n in input().split()]
A.sort()
def insert_sort(arr):
    for i in range(1, len(arr)):
        j = i - 1
        ele = arr[i]
        while arr[j] > ele and j >= 0:
            arr[j + 1] = arr[j]
            j -= 1
        arr[j + 1] = ele
    return arr
        
for _ in range(M):
    A[-1] = A[-1]//2
    A = insert_sort(A)
print((sum(A)))

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

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

a = list([Fraction(1, int(x)) for x in input().split()])

heapq.heapify(a)

for i in range(m):
    x = heapq.heappop(a)
    heapq.heappush(a, Fraction(x.numerator * 2, x.denominator))

s = 0


for j in range(n):
    s += int(Fraction(a[j].denominator, a[j].numerator))

print(s)


# Optimized solution
import heapq
from fractions import Fraction

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

a = list([Fraction(1, int(x)) for x in input().split()])

heapq.heapify(a)

for i in range(m):
    x = heapq.heappop(a)
    y = Fraction(x.numerator * 2, x.denominator)
    if y.numerator < y.denominator:
        heapq.heappush(a, y)
    elif len(a) == 0:
        break

s = 0


for j in range(len(a)):
    s += int(Fraction(a[j].denominator, a[j].numerator))

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

heap = []
for i in a:
    heapq.heappush(heap, -i)


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



print((sum([int (-n) for n in heap])))


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

heap = []
for i in a:
    heapq.heappush(heap, -i)


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



print((sum([int (-n) for n in heap])))
# Original solution
n, m = list(map(int, input().split()))
li_a = list(map(int, input().split()))
li_w = li_a
for i in range(m):
    li_w = sorted(li_w, reverse=True)
    li_w[0] = li_w[0] // 2

print((sum(li_w)))


# Optimized solution
import heapq
import math

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


for i in range(m):
    w = heapq.heappop(li_a)
    heapq.heappush(li_a, math.ceil(w / 2))

print((sum(li_a) * -1))
# Original solution
def main():
    import heapq
    n, m, *a = [-int(x) for x in open(0).read().split()]
    heapq.heapify(a)
    while m:
        x = heapq.heappop(a)
        heapq.heappush(a, x / 2)
        m += 1
    ans = -sum([int(x) for x in a])
    print(ans)
    


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    import heapq
    n, m, *a = [-int(x) for x in open(0).read().split()]
    heapq.heapify(a)
    for _ in range(-m):
        x = heapq.heappop(a)
        heapq.heappush(a, x / 2)

    ans = -sum([int(x) for x in a])
    print(ans)


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_item = A.index(max(A))
  A[max_item] //= 2
print((sum(A)))

# Optimized solution
import heapq

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

#全要素に-1かける
for i in range(len(A)):
    A[i] *= -1 

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

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

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

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

from heapq import heappush, heappop
hq=[]

for a_val in a:
    # heappopで最も小さい値が取り出されるため、(-1)をかけて入れる
    heappush(hq, -a_val)
for _ in range(m):
    heappush(hq, -(heappop(hq)//(-2)))
print((-sum(hq)))
# Original solution
import heapq
n, m = list(map(int, input().split()))
A = list([int(x)*-1 for x in input().split()])

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

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

# 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_elm = heapq.heappop(A)*-1 //2
  heapq.heappush(A, max_elm*-1)

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

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

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

print((sum(A)))

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

A = list(map(int, input().split()))
h = []

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

for i in range(N):
    heapq.heappush(h, A[i])

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

print((-sum(h)))
# Original solution
f = lambda:list(map(int,input().split()))
_,m = f()
l = list([-x for x in f()])
import heapq as hq
hq.heapify(l)
for i in range(m):
  p = -hq.heappop(l)//2
  hq.heappush(l,-p)
print((-sum(l)))

# Optimized solution
f=lambda:input().split()
_,m=list(map(int,f()))
l=[-int(i) for i in f()]
from heapq import *
heapify(l)
for _ in range(m):
  heappush(l,-(-heappop(l)//2))
print((-sum(l)))
# Original solution
f = lambda:list(map(int,input().split()))
n,m = f()
l = sorted(f())
for _ in range(m):
  l.append(l.pop()//2)
  l.sort()
print((sum(l)))

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