CodeEff/ECCO huggingface dataset:
# Original solution
#!/usr/bin/python3
# -*- coding:utf-8 -*-

import bisect

def main():
  MAX = 10**9
  n, m = list(map(int, input().strip().split()))
  As = sorted(list(map(int, input().strip().split())))
  for _ in range(m):
    x = As.pop(len(As)-1)
    x >>= 1
    As.insert(bisect.bisect_left(As, x), x)
  print((sum(As)))
    

if __name__=='__main__':
  main()



# Optimized solution
#!/usr/bin/python3
# -*- coding:utf-8 -*-

import heapq

def main():
  MAX = 10**9
  n, m = list(map(int, input().strip().split()))
  As = sorted(list([-int(x) for x in input().strip().split()]))
  hq = heapq.heapify(As)
  for _ in range(m):
    x = heapq.heappop(As)
    x = -(-x//2)
    x = heapq.heappush(As, x)
  print((-sum(As)))
    
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[A.index(max(A))]//=2
print((sum(A)))

# Optimized solution
import heapq

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

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

A=[i*-1 for i in A]

heapq.heapify(A)

for i in range(m):
    x=heapq.heappop(A)
    if x%2==0:
        heapq.heappush(A,x//2)
    else:
        heapq.heappush(A,x//2+1)
print((-1*sum(A)))
# Original solution
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))
A = sorted(A,reverse=True)
for i in range(M):
    A[0] =A[0]//2
    m = max(A)
    i = A.index(max(A))
    if m != A[0]:
        A[i] = A[0]
        A[0] = m
print((sum(A)))


# Optimized solution
#from operator import itemgetter
#from collections import Counter
import heapq
#N = int(input())
N, M = list(map(int, input().split()))
A = list([int(x)*(-1) for x in input().split()])
#A = [int(input()) for i in range(N)]

heapq.heapify(A)

for i in range(M):
    max = heapq.heappop(A)
    heapq.heappush(A, max*(-1)//2*(-1))
print((-sum(A)))
# Original solution
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()

for _ in range(M):
	a = A.pop()
	a = a >> 1
	for i in range(len(A)):
		if A[i] > a:
			A.insert(i, a)
			break
	else:
		A.append(a)
			

sum = 0
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()))
h = []

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

sum = 0
for _ in range(N): 
	sum -= heapq.heappop(h)
print(sum)
# Original solution
import bisect
N, M = list(map(int,input().split()))
al = list(map(int,input().split()))
al.sort()

for _ in range(M):
    x = al.pop()
    bisect.insort(al, x//2)

print((sum(al)))

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

for _ in range(M):
    tmp_min = heapq.heappop(al)
    heapq.heappush(al, -1*(-tmp_min//2))
print((-sum(al)))
# Original solution
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(m):
    p = max(a)
    index = a.index(p)
    a[index] = a[index] // 2
print((sum(a)))

# 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
heapq.heapify(a)

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

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

# Optimized solution
import sys
import os
import math
import heapq

N, M = list(map(int,input().split()))
A = list(map(int,input().split()))
#大きいものから取り出したいので-1倍してqueueに入れる

Q = []
for a in A:
    heapq.heappush(Q,-a)

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

print((-sum(Q)))
# Original solution
def solve():
    n, m = list(map(int, input().split()))
    a = sorted(list(map(int, input().split())))
    # 最大の値でチケットを使う
    # まだ最大かどうか考慮Y：もう一度使うN:バイナリーサーチをかけてリストをソートする
    for i in range(m):
        a[len(a)-1] //= 2
        if a[len(a)-1] < a[len(a)-2]:
            a = binary_search(a, a[len(a)-1])
    return sum(a)


def binary_search(lst, num):
    lst.pop(len(lst)-1)
    left, right = 0, len(lst)-1
    while left <= right:
        mid = (left + right)//2
        if lst[mid] < num:
            left = mid + 1
        else:
            right = mid-1
    lst.insert(mid, num)
    return lst


ans = solve()
print(ans)


# Optimized solution
import heapq  # 優先度付きキュー
# def solve():  # TLE
#     n, m = map(int, input().split())
#     # O(nlog(n))
#     a = sorted(list(map(int, input().split())))
#     # 最大の値でチケットを使う
#     # まだ最大かどうか考慮Y：もう一度使うN:バイナリーサーチをかけてリストをソートする
#     # O(m)
#     for i in range(m):
#         a[len(a)-1] //= 2
#         if a[len(a)-1] < a[len(a)-2]:
#             # O(log2m)
#             a = binary_search(a, a[len(a)-1])
#     return sum(a)


def solve():
    n, m = list(map(int, input().split()))
    a = list([int(x)*-1 for x in input().split()])
    heapq.heapify(a)  # aを優先度付きキューに変更
    for _ in range(m):  # _　iで注意が出ない(インスタンスを作らない)
        tmp_min = heapq.heappop(a)  # aの最大の値のpop
        heapq.heappush(a, (-1)*(-tmp_min//2))  # 計算誤差が生じるため(//2の返り値はintのため)
    return -sum(a)


def binary_search(lst, num):
    lst.pop(len(lst)-1)
    left, right = 0, len(lst)-1
    while left <= right:
        mid = (left + right)//2
        if lst[mid] < num:
            left = mid + 1
        else:
            right = mid-1
    lst.insert(mid, num)
    return lst


ans = solve()
print(ans)
# Original solution
import sys
sys.setrecursionlimit(int(1e6))
import math

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

if N > M:
    A.sort(reverse=True)
    A1 = A[0:M]
    A2 = A[M:]
    for _ in range(M):
        i = A1.index(max(A1))
        A1[i] = A1[i] // 2
    print((sum(A1 + A2)))
else:
    for _ in range(M):
        i = A.index(max(A))
        A[i] = A[i] // 2
    print((sum(A)))


# Optimized solution
import sys
sys.setrecursionlimit(int(1e6))

import heapq

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

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

prices = [- heapq.heappop(h_A) for _ in range(N)]
print((sum(prices)))
# Original solution
from functools import reduce
from operator import add

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

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

print((reduce(add, alist)))


# Optimized solution
import heapq
from functools import reduce

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

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

print((-reduce(lambda a, b: a+b, h)))
# 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(i) for i in input().split()]
heapq.heapify(a)
for _ in range(m):
    mx = -heapq.heappop(a)
    heapq.heappush(a, -(mx // 2))
print((-sum(a)))
# Original solution
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
A.sort(reverse = True)
for _ in range(M):
  for i in range(N):
    if A[i] == max(A):
      A[i] = A[i]/2
      break

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

print((sum(A)))

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

from bisect import insort
while M>0:
  a = A.pop()
  a /= 2
  insort(A,a)
  M-=1
ans = 0
for a in A:
  ans += int(a)
print(ans)
  

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

for _ in range(m):
  max_i = a_list.index(max(a_list))
  a_list[max_i] = a_list[max_i] // 2

print((sum(a_list)))

# Optimized solution
import heapq

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

heapq.heapify(a_list)
for _ in range(m):
  min_n = heapq.heappop(a_list)
  heapq.heappush(a_list, (min_n//2 if min_n%2 == 0 else min_n//2+1))
print((sum(a_list) * (-1)))
# Original solution
import math
N,M=list(map(int, input().split()))
A=list(map(int, input().split()))
for i in range(M):
    A.sort()
    A[N-1]=math.trunc(A[N-1]/2)
print((sum(A)))

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

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

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

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

sum = sum(s)
print(sum)

# Optimized solution
# coding: utf-8
import heapq

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

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

print((-sum(s)))
# Original solution
import bisect

n, m = list(map(int, input().split()))
item = [int(a) for a in input().split()]
item.sort()
ans = 0

for _ in range(m):
    item_max = item.pop()
    bisect.insort_left(item, item_max / 2)

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

print(ans)

# Optimized solution
import heapq

n, m = list(map(int, input().split()))
item = [-1 * int(a) for a in input().split()]
heapq.heapify(item)
ans = 0

for _ in range(m):
    item_max = heapq.heappop(item)
    item_max = item_max / 2
    heapq.heappush(item, item_max)

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

print((- ans))
# Original solution
import sys
input = sys.stdin.readline

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 sys
input = sys.stdin.readline
import heapq as hp

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

for i in range(m):
  tmp = hp.heappop(a)
  hp.heappush(a,(-tmp//2)*(-1))
#
print((-sum(a)))
# Original solution
N,M = list(map(int, input().split()))
A = list(map(int, input().split()))

for _ in range(M):

    max_A = max(A)
    ind = A.index(max_A)
    A[ind] = max_A//2

print((sum(A)))

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

heapq.heapify(A)


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

print((-1*sum(A)))
# Original solution
import heapq
n,m=[int(i) for i in input().split()]
a=[-1*int(i) for i in input().split()]
for i in range(m):
    heapq.heapify(a)
    b=heapq.heappop(a)
    b=b/2
    heapq.heappush(a,b)
ans=0
for i in a:
    ans-=int(i)
print(ans)

# Optimized solution
import heapq
n,m=[int(i) for i in input().split()]
a=[-1*int(i) for i in input().split()]
heapq.heapify(a)
for i in range(m):
    b=heapq.heappop(a)
    b=b/2
    heapq.heappush(a,b)
ans=0
for i in a:
    ans-=int(i)
print(ans)
# Original solution
from bisect import bisect_left as b
n,m= list(map(int,input().split()))
a=list(map(int,input().split()))
a.sort()
while m>0:
  i=a.pop(-1)//2
  a.insert(b(a,i),i)
  m-=1
print((sum(a)))

# Optimized solution
import heapq

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

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

print((-sum(A)))
# Original solution
n,m=list(map(int,input().split()))
A=list(map(int,input().split()))
while(m>0):
    A=sorted(A,reverse=True)
    if n>1:
        while(A[0]>=A[1]):
            A[0]=A[0]//2
            m-=1
    else:
        A[0]=A[0]//2
        m-=1
print((sum(A)))

# Optimized solution
from heapq import heappop,heappush,heapify
n,m=list(map(int,input().split()))
A=list(map(int,input().split()))
A_m=list([-x for x in A])
heapify(A_m)
pop=lambda: -heappop(A_m)
push=lambda x: heappush(A_m,-x)
for _ in range(m):
    x=pop()
    push(x//2)
print((-sum(A_m)))
# Original solution
#!/usr/bin/env python3
import bisect

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

a.sort()
for i in range(m):
    value = a.pop()
    value //= 2
    insert_index = bisect.bisect_left(a, value)

    a.insert(insert_index, value)
print((sum(a)))


# Optimized solution
#!/usr/bin/env python3
import heapq
# import bisect

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

# print(a)
print((-sum(a)))
# Original solution
import sys, heapq


def main():
    
    input = sys.stdin.readline
    
    N, M = list(map(int, input().split()))
    value = []
    heapq.heapify(value)
    for inp in input().split():
        heapq.heappush(value, -int(inp))

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

    print((- sum(value)))
    
if __name__=="__main__":
    main()

# Optimized solution
import sys, heapq


def main():
    
    input = sys.stdin.readline
    
    N, M = list(map(int, input().split()))
    value = [-int(inp) for inp in input().split()]

    heapq.heapify(value)

    for _ in range(M):
        old_elem = heapq.heappop(value)
        if old_elem == 0:
            break
        new_elem = -(- old_elem // 2)
        heapq.heappush(value, new_elem)

    print((- sum(value)))
    
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.append(a.pop(a.index(max(a)))//2)
print((sum(a)))

# Optimized solution
import heapq as hq
n, m = list(map(int, input().split()))
a = []
for i in input().split(): hq.heappush(a, -int(i))
for i in range(m): hq.heappush(a, int(hq.heappop(a)/2))
print((-sum(a)))
# Original solution
def main():
    n, m = list(map(int, input().split()))
    a = [int(x) for x in input().split()]
    a.sort(reverse=True)
    ans = sum(a)
    diff = 0
    for i in range(1, m+1):
        a_i = a[:i]
        a_m = max(a_i)
        diff += a_m  - a_m // 2
        a_m_i = a_i.index(a_m)
        a[a_m_i] = a[a_m_i] // 2
    ans -= diff
    print(ans)
    
if __name__ == '__main__':
    main()

# Optimized solution
from heapq import heapify, heappush, heappop

def main():
    n, m = list(map(int, input().split()))
    a = [int(x)*-1 for x in input().split()]
    ans = sum(a)*-1
    diff = 0
    
    heapify(a)
    for _ in range(1, m+1):
        _h_a = heappop(a) * -1
        diff += _h_a - _h_a // 2
        heappush(a, (_h_a // 2)*-1)
    ans -= diff
    print(ans)
    
if __name__ == '__main__':
    main()
# Original solution
import math
import bisect

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

while M > 0:
  A.insert(bisect.bisect_left(A, A[-1]/2, hi=len(A)-1), A[-1]/2)
  A.pop(-1)
  M -= 1
  
A = list(map(math.floor, A))
print((sum(A)))
  
           

# Optimized solution
import math
import bisect

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

def XX(A, M):
  if M <= 0 or A[0]<1:
    return
  A[0] = A[0]/2
  M -= 1
  for i in range(1, len(A)):
    if A[i] > A[0] and M > 0:
      A[i] = A[i]/2
      M -= 1
    else:
      break
  A.sort(reverse = True)
  XX(A, M)
  
XX(A, M)
A = list(map(math.floor, A))
print((sum(A)))
# Original solution
import bisect
N, M = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
for i in reversed(list(range(M))):
    bisect.insort(A, A.pop(-1)//2)
print((sum(A)))

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

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

for _ in range(m):
    a[n-1] //= 2
    if a[n-1] < a[n-2]:
        b = a[:n-1]
        bisect.insort(b,a[n-1])
        a = copy.deepcopy(b)
    
print((sum(a)))

# Optimized solution
import heapq

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

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

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

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

for i in range(m):
  a = aaa.pop() // 2
  insert_index = bisect.bisect_right(aaa, a)
  aaa.insert(insert_index, a)
  
print((sum(aaa)))

# Optimized solution
import heapq

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

for i in range(m):
  a = -heapq.heappop(aaa) // 2
  heapq.heappush(aaa, -a)
  
print((-sum(aaa)))
# Original solution
from bisect import insort

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

for i in range(m):
	new_amax = a_s[-1] // 2
	a_s = a_s[:-1]
	insort(a_s, new_amax)

res = sum(a_s)
print(res)

# Optimized solution
from math import ceil
from heapq import *

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

for _ in range(m):
	amax = heappop(a_s)
	heappush(a_s, ceil(amax / 2))

res = sum([-heappop(a_s) for _ in range(n)])
print(res)
# Original solution
from math import ceil
from heapq import *

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

for _ in range(m):
	amax = heappop(a_s)
	heappush(a_s, ceil(amax / 2))

res = sum([-heappop(a_s) for _ in range(n)])
print(res)

# Optimized solution
from math import ceil
from heapq import *

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

for _ in range(m):
	amax = -heappop(a_s)
	heappush(a_s, -(amax // 2))

res = -sum(a_s)
print(res)
# Original solution
n,m = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]

for _ in range(m):
    a.sort()
    a[-1] = int(a[-1] / 2)

print((sum(a)))

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

heapq.heapify(a)

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

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

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

for i in range(m):
    max = 0
    for j in range(n):
        if max < a[j]:
            max = a[j]
            max_i = j
    a[max_i] = math.floor(a[max_i] / 2)
###    a[a.index(max(a))] = math.floor(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)
    heapq.heappush(a, (t // 2) * (-1))

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

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

print((sum(a)))

# Optimized solution
import heapq

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

#heapqでは最小値しか取り出せないので，*(-1)することで最大値を取り出す
for i in range(len(a)):
    a[i] *= -1

#リストを優先度付きキューにする
heapq.heapify(a)

for i in range(n[1]):
    #最小値(実際には最大値であるはずの値)を取り出す
    tmp = heapq.heappop(a)

    #取り出した値を2で割って切り下げで優先度付きキューに挿入
    heapq.heappush(a, int(tmp/2))

print((-sum(a)))

'''
max()はO(N)．heapqはO(logN)
これだと発想はあっているが，O(NM)となるので間に合わない
for i in range(n[1]):
    a[a.index(max(a))] = int(max(a) / 2)

print(sum(a))
'''
# Original solution
def main():
    n, m = list(map(int, input().split()))
    a_list = list(map(int, input().split()))

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

    print((sum(a_list)))


if __name__ == '__main__':
    main()


# Optimized solution
import heapq


def main():
    n, m = list(map(int, input().split()))
    a_list = list([-int(x) for x in input().split()])

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

    print((-sum(a_list)))


if __name__ == '__main__':
    main()
# Original solution
def solve():
  import sys
  import math

  sys.setrecursionlimit(10**7)
  readline=sys.stdin.readline

  n,m = list(map(int,input().split()))
  a = list(map(int,input().split()))
  a.sort()
  
  for i in range(m):
    a += [a.pop()//2]
    a.sort()
  
  print((sum(a)))

if __name__ == '__main__':
  solve()

# Optimized solution
def solve():
  import sys
  import math
  import heapq

  sys.setrecursionlimit(10**7)
  readline=sys.stdin.readline

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

if __name__ == '__main__':
  solve()
# Original solution
import bisect
N , M = list(map(int,input().split()))
A = [int(i) for i in input().split()]
A.sort()
for _ in range(M):
    a = A.pop(-1) >> 1
    A.insert(bisect.bisect_left(A,a),a)
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):
    a = -heapq.heappop(A) >> 1
    heapq.heappush(A,-a)
print((-sum(A)))