Takahashi is going to buy N items one by one.
The price of the i-th item he buys is A_i yen (the currency of Japan).
He has M discount tickets, and he can use any number of them when buying an item.
If Y tickets are used when buying an item priced X yen, he can get the item for \frac{X}{2^Y} (rounded down to the nearest integer) yen.
What is the minimum amount of money required to buy all the items?

-----Constraints-----
 - All values in input are integers.
 - 1 \leq N, M \leq 10^5
 - 1 \leq A_i \leq 10^9

-----Input-----
Input is given from Standard Input in the following format:
N M
A_1 A_2 ... A_N

-----Output-----
Print the minimum amount of money required to buy all the items.

-----Sample Input-----
3 3
2 13 8

-----Sample Output-----
9

We can buy all the items for 9 yen, as follows:
 - Buy the 1-st item for 2 yen without tickets.
 - Buy the 2-nd item for 3 yen with 2 tickets.
 - Buy the 3-rd item for 4 yen with 1 ticket.

Difficulty: interview

Starter code:

Solutions:
# import itertools
# import math
# import sys
# sys.setrecursionlimit(500*500)
# import numpy as np
from collections import deque

# N = int(input())
# S = input()
# n, *a = map(int, open(0))
N, M = map(int, input().split())
A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

A = sorted(A, reverse=True)
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

# def factorization(n):
#     arr = []
#     temp = n
#     for i in range(2, int(-(-n**0.5//1))+1):
#         if temp%i==0:
#             cnt=0
#             while temp%i==0:
#                 cnt+=1
#                 temp //= i
#             arr.append([i, cnt])
#     if temp!=1:
#         arr.append([temp, 1])
#     if arr==[]:
#         arr.append([n, 1])
#     return arr


queue_A = deque(A)
queue_B = deque()

for i in range(M):
    if len(queue_B) > 0 and queue_B[0] >= queue_A[0]:
        queue_A.appendleft(queue_B.popleft())
    queue_A[0] //= 2
    if len(queue_A) > 1 and queue_A[0] < queue_A[1]:
        queue_B.append(queue_A.popleft())

print(sum(queue_A) + sum(queue_B))

from heapq import heapify, heappush, heappop

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

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

heapify(A)
for i in range(m):
    x = heappop(A)
    x = (x + 1) // 2
    heappush(A, x)

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


# -*- coding: utf-8 -*-
"""
Created on Wed Sep 16 17:42:18 2020

@author: liang
"""
"""
【優先度付きキュー】
・ヒープ構造の部分順序付き木
・挿入、削除、最大値（最小値）の取り出し、要素の値の変更
　⇒　O(log n)
・ヒープ生成
　⇒O(n)
 【使い方】
  import heapq
  ●heapq.heapify(list) #最小値
  ●heapq.heapify(list(map(lambda x:int(x)*(-1),list))) #最大値は値をひっくり返す
  ●heapq.heappop(a)
  ●heapq.heappush(a,1)
"""

import heapq
N, M = map(int, input().split())
# -1倍する
A = [int(x)*(-1) for x in input().split()]
heapq.heapify(A)

#O(M) * O(log N)
for i in range(M):
    Max = heapq.heappop(A) * (-1)
    Max //= 2
    heapq.heappush(A, Max*(-1))
print(-sum(A))

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


import heapq

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

A_list_minus = list(map(lambda x: x*(-1), A_list))  # 各要素を-1倍
heapq.heapify(A_list_minus)

for i in range(M):
    tmp_max = heapq.heappop(A_list_minus)*(-1)
    heapq.heappush(A_list_minus, (-1)*(tmp_max//2)) #挿入するときは最小に

print(-1*sum(A_list_minus))

import heapq
n,m=map(int,input().split())
a=list(map(lambda x:-int(x),input().split()))
heapq.heapify(a)
for i in range(m):
  heapq.heapreplace(a,a[0]/2)

print(-sum(map(int,a)))

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

print((-sum(A)))


import sys
def input(): return sys.stdin.readline().rstrip()
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):
    a = heapq.heappop(A)
    a *= -1
    a //= 2
    a *= -1    
    heapq.heappush(A,a)

print((-sum(A)))


import heapq
N,M=map(int,input().split())
A=list(map(lambda x:int(x)*(-1),input().split()))

heapq.heapify(A)

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

print(-sum(A))

import heapq, math

n, m = map(int, input().split())
A = list(map(int, input().split()))
a = list(map(lambda x: x*(-1), 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))


import heapq as he

n,m = map(int,input().split())
a = list(map(int,input().split()))
a = list(map(lambda x: x*(-1),a))
he.heapify(a)

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

print(sum(a)*(-1))

from heapq import heappop, heappush, heapify

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

heapify(arr)

for _ in range(m):
    a = heappop(arr)
    heappush(arr, -(-a // 2))

print(-sum(arr))

import heapq
n,m = map(int,input().split())
a = list(map(lambda x: int(x)*(-1),input().split()))
heapq.heapify(a) #aを優先度付きキューにする
for _ in range(m):
    tmp = heapq.heappop(a)
    heapq.heappush(a,(-1)*(-tmp//2))
print((-1)*sum(a))

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

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

price = [-i for i in price]

heapq.heapify(price)

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

price = [-i for i in price]

print(sum(price))

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

import heapq
class Heapq:
    def __init__(self, arr, desc=False):
        if desc:
            arr = [-a for a in arr]
        self.sign = -1 if desc else 1
        self.hq = arr
        heapq.heapify(self.hq)
 
    def pop(self):
        return heapq.heappop(self.hq) * self.sign
 
    def push(self, a):
        heapq.heappush(self.hq, a * self.sign)
 
    def top(self):
        return self.hq[0] * self.sign
        
N,M=list(map(int,input().split()))
A=list(map(int,input().split()))

q = Heapq(A, True)
    
for i in range(M):
    x=q.pop()
    q.push(x//2)

print((sum([q.pop() for _ in range(N)])))


import heapq

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

print(sum(a)*-1)

import sys
input=sys.stdin.readline #文字列入力はするな！！
import heapq
n,m=list(map(int,input().split()))
a=[]
for i in input().split():
    heapq.heappush(a,-int(i))
for i in range(m):
    p=-heapq.heappop(a)
    p=p//2
    heapq.heappush(a,-p)
print((-sum(a)))



import heapq
n, m = list(map(int, input().split()))
A = sorted([-int(x) for x in input().split()])
for _ in range(m):
    a = heapq.heappop(A)
    a = -(-a//2)
    heapq.heappush(A, a)

print((-sum(A)))


import sys
import math
import itertools
import collections
from collections import deque
import heapq 

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():

    N, M = NMI()
    A = NLI()
    
    A = list(map(lambda x: x*(-1), A))
    
    heapq.heapify(A)
    
    for m in range(M):
        highest = (heapq.heappop(A)*(-1))
        discounted = math.floor(highest/2) * -1
        heapq.heappush(A, discounted)

        
    print(sum(A)*-1)
#

def __starting_point():
    main()
__starting_point()

import heapq
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
ls = []
for item in A:
  heapq.heappush(ls, -item)
for m in range(M):
  tmp = -heapq.heappop(ls)
  tmp = tmp // 2
  heapq.heappush(ls, -tmp)
print((-sum(ls)))


from heapq import *

n, m = map(int, input().split())
A = list(map(lambda x: int(x)*(-1), input().split()))
heapify(A)

for _ in range(m):
    max_a = heappop(A)*(-1)
    max_a //= 2
    heappush(A, -max_a)
print(-sum(A))

import math
import heapq
 
n,m = map(int,input().split())
a = list(map(lambda x: int(x)*-1,input().split()))
 
heapq.heapify(a)
# print(a)
for i in range(m):
    heapq.heappush(a,math.ceil(heapq.heappop(a)/2))
 
print(int(-1 *sum(a)))

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

#　優先度付きキューが難しい


import sys
import heapq


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

while m > 0:
    max_a = heapq.heappop(a_list)
    heapq.heappush(a_list, (-1)*(-max_a//2))
    m -= 1

print((-sum(a_list)))


import sys
# import math
# import bisect
# import numpy as np
# from decimal import Decimal
# from numba import njit, i8, u1, b1 #JIT compiler
# from itertools import combinations, product
# from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b)
def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b)

from heapq import heapify, heappop, heappush
def Main():
    n, m = read_ints()
    a = read_int_list()
    a = [-x for x in a]
    heapify(a)
    
    while m:
        cost = heappop(a)
        if cost == 0:
            break
        heappush(a, -(-cost//2))
        m -= 1
    print(-sum(a))

def __starting_point():
    Main()
__starting_point()

import heapq

def __starting_point():

    n,m = map(int,input().split())
    A = list(map(lambda x:int(x)*(-1),input().split()))
    heapq.heapify(A)

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

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

import heapq

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


from heapq import *
N,M = map(int,input().split())
A = list(map(lambda x:-int(x),input().split()))
heapify(A)

for m in range(M):
  heappush(A,int(heappop(A)/2))

print(-sum(A))

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

import heapq
a = list(map(lambda x:x*(-1),a))
heapq.heapify(a)

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

N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
import heapq
a = list([x*(-1) for x in A])  # 各要素を-1倍

heapq.heapify(a)
for i in range(K):
  num = heapq.heappop(a)*(-1)
  heapq.heappush(a, -1*(int(num/2)))
  #print(num,a)
  if num == 0:
    break
print((-sum(a)))


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

a=[-i for i in a]
heapq.heapify(a)
for _ in range(m):
     b=heapq.heappop(a)
     heapq.heappush(a,-((-b)//2))

print(-sum(a))

# import itertools
# import math
# import sys
# sys.setrecursionlimit(500*500)
# import numpy as np
# from collections import deque
import heapq

# N = int(input())
# S = input()
# n, *a = map(int, open(0))
N, M = list(map(int, input().split()))
A = list([int(x)*(-1) for x in input().split()])
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# A = sorted(A, reverse=True)
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

# def factorization(n):
#     arr = []
#     temp = n
#     for i in range(2, int(-(-n**0.5//1))+1):
#         if temp%i==0:
#             cnt=0
#             while temp%i==0:
#                 cnt+=1
#                 temp //= i
#             arr.append([i, cnt])
#     if temp!=1:
#         arr.append([temp, 1])
#     if arr==[]:
#         arr.append([n, 1])
#     return arr

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

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


import heapq
n, m = map(int, input().split())
a = list(map(int, input().split()))
if n == 1:
    print(a[0] // (2 ** m))
    return
a = list(map(lambda x: x * (-1), a))
heapq.heapify(a)
while m > 0:
    m -= 1
    i = heapq.heappop(a) * (-1)
    i //= 2
    heapq.heappush(a, i * (-1))

print(sum(a) * (-1))

import heapq
n, m = map(int, input().split())
a = list(map(int, input().split()))
a = list(map(lambda x: x*(-1), a))
heapq.heapify(a)

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

ans = 0
for aa in a:
    ans += aa//(-1)
print(int(ans))

import heapq

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

heapq.heapify(A)

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

import heapq
n, m = 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 = ((-1) * heapq.heappop(a)) //2
    heapq.heappush(a, -x)
print(-sum(a))

import sys
import re
import queue
import collections
import math
from decimal import *
from copy import deepcopy
from collections import Counter, deque
import heapq
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from typing import Callable
from decimal import Decimal, getcontext
# input = sys.stdin.readline
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
	N,M = i_map()
	A = i_list()

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

	heapq.heapify(A)

	for i in range(0,M):
		tmp = math.ceil(heapq.heappop(A)/2)
		heapq.heappush(A,tmp)

	sum = 0
	for i in range(0,len(A)):
		sum +=- heapq.heappop(A)

	print(sum)


def __starting_point():
	main()
__starting_point()

import heapq

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

a=list(map(lambda x:int(x)*(-1),input().split()))

heapq.heapify(a)

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

print(-sum(a))

import heapq
import sys

lines = sys.stdin.readlines()

N, M = [int(n) for n in lines[0].strip().split()]
prices = [-int(n) for n in lines[1].strip().split()]

heapq.heapify(prices)

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

print(-sum(prices))

import heapq

n, m = map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)  # aを優先度付きキューに

for _ in range(m):
    tmp_min = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-tmp_min//2))  # 負数の剰余演算を避けるため一時的に0以上の整数にしています
print(-sum(a))

import heapq
from collections import deque
n,m=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):
    x=heapq.heappop(A)
    if x%2==0:
        x//=2
    else:
        x=x//2 +1
    heapq.heappush(A,x)

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

import heapq

# 優先度付きキューは「最も値が小さいもの」を出すことに注意

prio = []

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

for num in nums:
    heapq.heappush(prio, -num)

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

print((-sum(prio)))


import math
import heapq

n,m = map(int,input().split())
a = list(map(lambda x: int(x)*-1,input().split()))

heapq.heapify(a)
# print(a)
for i in range(m):
    heapq.heappush(a,math.ceil(heapq.heappop(a)/2))

print(int(-1 *sum(a)))

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

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

for _ in range(m):
    tmp = heappop(heap)
    heappush(heap,-(-tmp//2))

ans = 0
for a in heap:
    ans += -a 
print(ans)

import heapq


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

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

print((-sum(A)))


import re
import sys
import math
import itertools
import bisect
import heapq#.heapify:Priority Queueに変換 
#.heappop:最小値取得, .heappush:要素挿入
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def get_primenumber(number):#素数列挙
    prime_list = []
    search_list = list(range(2,number+1))
    #search_listの先頭の値が√nの値を超えたら終了
    while search_list[0] <= math.sqrt(number):
      #search_listの先頭の値が√nの値を超えたら終了
      #search_listの先頭をprime_listに入れて、先頭をリストに追加して削除
        head_num = search_list.pop(0)
        prime_list.append(head_num)
        #head_numの倍数を除去
        search_list = [num for num in search_list if num % head_num != 0]
    #prime_listにsearch_listを結合
    prime_list.extend(search_list)
    return prime_list
def factrization_prime(number):#素因数分解
    factor = {}
    div = 2
    s = math.sqrt(number)
    while div < s:
        div_cnt = 0
        while number % div == 0:
            div_cnt += 1
            number //= div
        if div_cnt != 0:
            factor[div] = div_cnt
        div += 1
    if number > 1:
        factor[number] = 1
    return factor
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return list(map(int,input().split()))
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
num = []
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

n,m = I()
A = l()
A = list([x*-1 for x in A])
heapq.heapify(A)

for i in range(m):
    mm = heapq.heappop(A)
    if mm % 2 != 0:
        heapq.heappush(A,mm//2+1)
    else:
        heapq.heappush(A,mm//2)

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



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

print((-sum(A)))




import heapq
N,M = map(int,input().split())
lsA = list(map(int,input().split()))
lsA = [-i for i in lsA]
heapq.heapify(lsA)
for i in range(M):
    maxA = heapq.heappop(lsA)
    heapq.heappush(lsA,-(-maxA//2))
lsA = [-i for i in lsA]
print(sum(lsA))

#!/usr/bin/env python3

import heapq
#import
#import math
#import numpy as np
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))

A = [A[i] * (-1) for i in range(N)]
heapq.heapify(A)

for i in range(M):
    q = heapq.heappop(A)
    if q == 0:
        print((0))
        return
    heapq.heappush(A, int(q / 2))

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


import heapq

N, M = map(int, input().split())
A = list(map(lambda x: int(x) * (-1), input().split()))

heapq.heapify(A)

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

print(-sum(A))

from heapq import heapify,heappop,heappush

n,m = map(int,input().split())
a = list(map(lambda x: -int(x),input().split()))
heapify(a)
#print(a)

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

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

while M>0:
    a=heapq.heappop(hq)    
    heapq.heappush(hq,a/2)
    M-=1
    #print(hq)
ans=0
for i in hq:    
    ans+=int(-i)
    
print(ans)

import heapq

N, M = map(int,input().split())
A = list(map(lambda x: int(x) * (-1), input().split()))
heapq.heapify(A)

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

print(-sum(A))

import heapq

n, m = map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)  # aを優先度付きキューに

for _ in range(m):
    tmp_min = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-tmp_min//2))  # 負数の剰余演算を避けるため一時的に0以上の整数にしています
print(-sum(a))

import heapq
import math

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

def __starting_point():
    a = [-1 * i for i in A]
    heapq.heapify(a)

    for _ in range(M):
        #pop
        temp = heapq.heappop(a)
        #push
        heapq.heappush(a,math.ceil(temp / 2))

    print((sum(a) * -1))

__starting_point()

import heapq

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

heapq.heapify(A)

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

ans = -sum(A)

print(ans)

# -*- coding: utf-8 -*-
"""
Created on Wed Sep 16 12:35:58 2020

@author: liang
"""

N, M = map(int, input().split())
A = [int(x) for x in input().split()]
A.sort(reverse=True)
#print(A)
count = 0
while count != M:
    A[0] //= 2
    count += 1
    tmp = A[0]
    for i in range(1,N):
        if count == M:
            break
        if A[i] > tmp:
            A[i] //= 2
            count += 1
        ##   break
    A.sort(reverse=True)
ans = sum(A)
#print(A)
print(ans)

'''
Created on 2020/09/09

@author: harurun
'''
def main():
  import heapq
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  N,M=map(int,pin().split())
  A=list(map(int,pin().split()))
  B=list(map(lambda x: -x ,A))
  heapq.heapify(B)
  for i in range(M):
    t=heapq.heappop(B)
    s=-((-t)//2)
    heapq.heappush(B,s)
  ans=0
  for j in range(N):
    q=heapq.heappop(B)
    ans+=(-q)
  print(ans)
  return
main()

import heapq
n, m = [int(i) for i in input().split()]
a = [-int(i) for i in input().split()]
heapq.heapify(a)
for _ in range(m):
  value = heapq.heappop(a)
  value /= 2
  heapq.heappush(a, value)
for i in range(n):
  a[i] = int(-a[i])
print(sum(a))

import heapq
n, m, *a = list(map(int, open(0).read().split()))
a = list([-x for x in a])

heapq.heapify(a)
for i in range(m):
    b = -heapq.heappop(a)
    heapq.heappush(a, -(b >> 1))

print((-sum(a)))


def main():
	N, M = [int(x) for x in input().split(" ")]
	A = [int(a) for a in input().split(" ")]
	D = []
	for i in range(len(A)):
		tmp = A[i]
		while tmp > 0:
			half = int(tmp / 2)
			D.append(tmp - half)
			tmp = half
	D.sort(reverse=True)
	print(sum(A) - sum(D[:M]))

main()

import heapq
N, M =list(map(int, input().split()))
A=list([int(x)*(-1) for x in input().split()]) #各要素を-1倍
heapq.heapify(A) #Aを優先度付きキューに

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


import heapq

n, m = map(int,input().split())
hp = map(lambda x: (-1)*int(x), input().split())
hp = list(hp)
heapq.heapify(hp)

for i in range(m):
  item = -1*heapq.heappop(hp)
  # print('item',item)
  item = item //2
  heapq.heappush(hp, -item)
  
print(-1*sum(hp))

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

while m != 0 :
    max = heapq.heappop(cost)
    val = ((-1)*max//2)*(-1)
    m -= 1
    heapq.heappush(cost,val)

cost = list([x*(-1) for x in cost])
print((sum(cost)))


import heapq
n,m=map(int,input().split())
a=list(map(lambda x:-int(x),input().split()))
heapq.heapify(a)
for i in range(m):
    x=-heapq.heappop(a)
    heapq.heappush(a,-(x//2))
print(-sum(a))

import heapq

n,m=map(int,input().split())
a=list(map(lambda x:int(x)*(-1),input().split()))
heapq.heapify(a)

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

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

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

result = -sum([int(p) for p in hq])
print(result)


import heapq
N,M=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):
  n=heapq.heappop(A)
  heapq.heappush(A,-((-n)//2))
print(-sum(A))

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

while m != 0 :
    max = heapq.heappop(cost)
    val = ((-1)*max//2)*(-1)
    m -= 1
    heapq.heappush(cost,val)

cost = list([x*(-1) for x in cost])
print((sum(cost)))


import heapq

n, m = map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)

while m > 0:
    a_max = heapq.heappop(a)
    if a_max == 0:
        break
    heapq.heappush(a, (-1)*(-a_max // 2))
    m -= 1
print(sum(a)*(-1))

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


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

a = list(map(lambda x:(-1)*x,a))

heapq.heapify(a)

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

n,m=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))

from heapq import heapify, heappop, heappush
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
q = []
for a in A:
    q.append((a//2-a, a, 1))
heapify(q)
ans = sum(A)
for _ in range(M):
    discount, a, n = heappop(q)
    ans += discount
    if ans==0:
        break
    heappush(q, (a//2**(n+1)-a//2**n, a, n+1))
print(ans)


class Heap:
    """
    練習用に書いたクラス
    本番は'heapq'を使う
    """
    def __init__(self, x: list):
        # initialize
        self.heap = []
        for item in x:
            self.push(item)

    def push(self, item: int):
        self.heap.append(item)
        idx_child = len(self.heap) - 1
        while (idx_child > 0):
            idx_parent = (idx_child - 1) // 2
            if self.heap[idx_parent] <= item:
                break
            # swap
            tmp = self.heap[idx_child]
            self.heap[idx_parent], self.heap[idx_child] \
                = self.heap[idx_child], self.heap[idx_parent] 
            idx_child = idx_parent

    def pop(self) -> int:
        # 最小値
        ret = self.heap[0]
        # 最後尾をrootへ移動
        self.heap[0] = self.heap[-1]
        self.heap.pop()
        idx_parent = 0
        while (idx_parent * 2 + 1 < len(self.heap)):
            # 左に行くか右に行くか
            idx_child_l, idx_child_r = 2 * idx_parent + 1, 2 * idx_parent + 2
            if idx_child_r < len(self.heap) and self.heap[idx_child_r] < self.heap[idx_child_l]:
                idx_child = idx_child_r
            else:
                idx_child = idx_child_l
            # break
            if self.heap[idx_parent] <= self.heap[idx_child]:
                break
            self.heap[idx_child], self.heap[idx_parent] \
                = self.heap[idx_parent], self.heap[idx_child]
            idx_parent = idx_child
        return ret

    def load(self) -> list:
        return self.heap

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A = [ -a for a in A]
heap = Heap(A)
for _ in range(M):
    x = heap.pop()
    heap.push(x / 2)
A = heap.load()
A = [ int(-a) for a in A]
print(sum(A))

n,m=map(int,input().split())
import heapq

a=list(map(lambda x:int(x)*(-1), input().split()))
heapq.heapify(a)

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

import heapq
n,m = map(int,input().split())
a = list(map(int,input().split()))
a = list(map(lambda x:x*(-1),a))
heapq.heapify(a)
for i in range(m):
    x = heapq.heappop(a)*(-1)//2
    heapq.heappush(a,(x*(-1)))
print(sum(a)*(-1))

import heapq
n,m=map(int,input().split())
a=list(map(lambda x:-int(x),input().split()))
heapq.heapify(a)
for i in range(m):
    x=-heapq.heappop(a)
    heapq.heappush(a,-(x//2))
print(-sum(a))

from heapq import heapify,heappush,heappop

def main():
    N,M = list(map(int,input().split()))
    A = [-x for x in map(int,input().split())]
    heapify(A)
    for i in range(M):
        tmp = -heappop(A)
        tmp2 = tmp//2
        heappush(A,-tmp2)
    ans = 0
    for i in range(N):
        ans += A[i]

    ans = abs(ans)
    return ans

print((main()))


import heapq
import math
n,m=map(int,input().split())
a=list(map(lambda x:int(x)*(-1),input().split()))
heapq.heapify(a)
for i in range(m):
  x=heapq.heapreplace(a,math.ceil(a[0]/2))
print(sum(a)*(-1)) 

import sys
stdin = sys.stdin

n,m = map(int, stdin.readline().split())
an = [i*(-1) for i in map(int, stdin.readline().split())]
#print(an)
#print(sum(an))

import heapq
heapq.heapify(an)

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

#print(an)
ans = (-1)*sum(an)
print(ans)

import copy

def bi_search(money,M,N):
    money.sort()
    #list = []
    #for i in range(0,money[N-1]+2,1):
        #list.append(i)
    left = 0
    right = money[N-1]+1
    mid = 0
    #print(list,left,right)
    while True:
        mid = int( (left+right)/2 )
        cnt = 0
        #print(left,right,mid)
        #print(money)
        money_tmp = copy.copy(money)
        for i in range(N):
            while True:
                #print(money_tmp[i],i)
                if money_tmp[i] <= mid:
                    break
                else:
                    money_tmp[i] //= 2
                    cnt += 1
        #print(cnt)
        if cnt == M:
            return mid,cnt
        elif cnt < M:
            right = mid
            tmp = cnt
        elif cnt > M:
            left = mid + 1

        if left == right:
            return right,tmp

def main():
    N,M = list(map(int,input().split()))
    A = list(map(int,input().split()))
    max_money,cnt = bi_search(A,M,N)
    #print (cnt)
    cnt = M-cnt
    ans = 0
    for i in range(N):
        if max_money >= A[i]:
            continue
            #ans += A[i]
        else:
            while True:
                A[i] //= 2
                if max_money >= A[i]:
                    #ans += A[i]
                    break
    A.sort(reverse = True)
    j = 0
    if A[j] == 0:
        return 0
    for i in range(cnt):
        A[j] //= 2
        j += 1

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

    return ans

print((main()))


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

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

print((-sum(A)))


#!/usr/bin/env python3
import heapq
# input = stdin.readline

def solve(n,m,a):
  a = [-x for x in a]
  heapq.heapify(a)
  for _ in range(m):
    x = heapq.heappop(a)
    heapq.heappush(a,-(abs(x)//2))
  return abs(sum(a))


def main():
  N,M = list(map(int,input().split()))
  a = list(sorted(map(int,input().split())))
  print((solve(N,M,a)))
  pass

def __starting_point():
  main()

__starting_point()

import math

class Heap():

    def __init__(self,array):
        self.array = list(array)
        self._build_heap()

    def _build_heap(self):
        for i in reversed(range(len(self.array)//2)):
            self._min_heap(i)


    def _min_heap(self,i):
        #indexを1からスタート扱いにして計算し戻す
        left = (2*(i+1))-1
        right= (2*(i+1)+1)-1
        length = len(self.array) -1
        smallest = i

        if left <=length and self.array[i]>self.array[left]:
            smallest = left
        if right <=length and self.array[smallest]>self.array[right]:
            smallest = right
        if smallest != i:
            self.array[i],self.array[smallest]=self.array[smallest],self.array[i]
            self._min_heap(smallest)

    def pop(self):
        tmp = self.array[0]
        self.array[0] = self.array[-1]
        del self.array[-1]
        self._min_heap(0)
        return tmp

    def push(self,v):
        self.array.append(v)
        index = len(self.array)#1スタート換算のindex
        while self.array[(index//2)-1] > self.array[index-1]:
            self.array[(index//2)-1],self.array[index-1]=self.array[index-1],self.array[(index//2)-1]
            index = index//2

n,m = map(int,input().split())
a = map(lambda x: int(x)*-1,input().split())

a = Heap(a)

for i in range(m):
    # print(a.array)
    a.push(math.ceil(a.pop()/2))

print(int(-1 *sum(a.array)))

# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


N, M = zz()
A = zz()
A = [-a for a in A]
heapq.heapify(A)

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


import heapq
import math

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

def __starting_point():
    a = [-1 * i for i in A]
    heapq.heapify(a)

    for _ in range(M):
        #pop
        temp = heapq.heappop(a)
        #push
        heapq.heappush(a,math.ceil(temp / 2))

    ans = [-1 * i for i in a]
    print((sum(ans)))

__starting_point()

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)))


import heapq

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

a = list(map(lambda x: -x, a))
heapq.heapify(a)
for _ in range(m):
    heapq.heappush(a, -((-heapq.heappop(a))//2))
print(-sum(a))

3

import heapq

def main():
    line1 = input()
    line2 = input()

    n, m = list(map(int, line1.split()))
    l = list(map(int, line2.split()))
    ans = sum(l)
    for i in range(len(l)):
        l[i] *= -1
    heapq.heapify(l)
    for i in range(m):
        price = heapq.heappop(l) * (-1)
        new_price = price // 2
        heapq.heappush(l, new_price * (-1))
        ans -= (price - new_price)
    print(ans)
    return

def __starting_point():
    main()
__starting_point()

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

lis = []
for i in a:
    lis.append(-1*i)

heapq.heapify(lis)

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

print(-sum(lis))

import heapq

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

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