CodeEff/ECCO huggingface dataset:
# Original solution
import bisect
import sys
input = sys.stdin.readline

def main():

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

    while M > 0:
        tmp = A.pop()
        tmp = tmp // 2
        bisect.insort_right(A, tmp)
        M -= 1
    print((sum(A)))

if __name__ == '__main__':
    main()

# Optimized solution
import heapq
import sys

input = sys.stdin.readline


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


if __name__ == '__main__':
    main()
# Original solution
#ソートしてでかいやつから割引券使っていって、次に値段が高いやつよりも値段が低くなれば次にいく。
#これを繰り返せばいい。
#一周してもまだ割引券が余っていればもう一度ソートして同じことをする。
#途中で割引券がなくなれば終了して、合計を計算する。
#実際に買い物をする順番は気にしなくていい。どこで何枚使うのが最適かが分かればいい
#ということは割引券を使うたび毎回ソートする？

n,m = list(map(int,input().split()))
A = list(map(int,input().split()))
#print(A)
A.sort(reverse=True)

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



# Optimized solution
#ソートしてでかいやつから割引券使っていって、次に値段が高いやつよりも値段が低くなれば次にいく。
#これを繰り返せばいい。
#一周してもまだ割引券が余っていればもう一度ソートして同じことをする。
#途中で割引券がなくなれば終了して、合計を計算する。
#実際に買い物をする順番は気にしなくていい。どこで何枚使うのが最適かが分かればいい
#ということは割引券を使うたび毎回ソートする？
#毎回ソートしてるとやっぱりTLEになる。次に値段が高いやつよりも値段が低くなれば次にいく。でいい

#n,m = map(int,input().split())
#A = list(map(int,input().split()))
#print(A)
#A.sort(reverse=True)
#while m!=0:
#  while A[0] > A[1]:
 #   M_A = max(A)
  #  A[0] = M_A //2
   # m -= 1
  #A.sort(reverse=True)
#print(sum(A))

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 j in range(m):
  # 最小値を取り出して-1をかけ,bとする。
  b=heapq.heappop(a)*(-1)
  # b//2に-1をかけて,aに入れる。
  heapq.heappush(a,(b//2)*(-1))
  #print(a)
c=sum(a)
print((c*(-1)))
# Original solution
from heapq import heappop, heappush
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
H = []
for a in A:
    heappush(H, -a)

cnt = 0
while cnt < M:
    a = heappop(H)
    heappush(H, -((-a)//2))
    cnt += 1

print((-sum(H)))

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

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

print((-sum(H)))
# Original solution
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.buffer.readline
class SkewHeap:
  def __init__(self, init_val = None, left = None, right = None):
    self.val = init_val
    self.left = left
    self.right = right
    self.root = None
  def heapmeld(self, h1, h2):
    if h1 == None: return h2
    if h2 == None: return h1
    if h1.val > h2.val:
      h1.val, h1.left, h1.right, h2.val, h2.left, h2.right = h2.val, h2.left, h2.right, h1.val, h1.left, h1.right
    h1.right = self.heapmeld(h2, h1.right)
    return h1
  def heappop(self):
    if self.root == None:
      res = self.val
      h = self.heapmeld(self.left, self.right)
      if h == None: h = SkewHeap(None)
      self.val, self.left, self.right = h.val, h.left, h.right
      return res
    res = self.root.val
    self.root = self.heapmeld(self.root.left, self.root.right)
    return res
  def heappush(self, x):
    h = SkewHeap(x)
    self.root = self.heapmeld(self.root, h)
N, M = list(map(int, input().split()))
a = list(map(int, input().split()))
h = SkewHeap()
res = 0
for e in a:
  h.heappush(-e)
for _ in range(M):
  h.heappush(-(-h.heappop() // 2))
for _ in range(N):
  res -= h.heappop()
print(res)

# Optimized solution
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.buffer.readline
class SkewHeap:
  def __init__(self, init_val = None):
    self.val = init_val
    self.left = None
    self.right = None
    self.root = None
  def heapmeld(self, h1, h2):
    if h1 == None: return h2
    if h2 == None: return h1
    if h1.val > h2.val:
      h1.val, h1.left, h1.right, h2.val, h2.left, h2.right = h2.val, h2.left, h2.right, h1.val, h1.left, h1.right
    h1.right = self.heapmeld(h2, h1.right)
    h1.left, h1.right = h1.right, h1.left
    return h1
  def heappop(self):
    res = self.root.val
    self.root = self.heapmeld(self.root.left, self.root.right)
    return res
  def heappush(self, x):
    h = SkewHeap(x)
    self.root = self.heapmeld(self.root, h)
  def heaptop(self):
    return self.root.val
N, M = list(map(int, input().split()))
a = list(map(int, input().split()))
h = SkewHeap()
res = 0
for e in a:
  h.heappush(-e)
for _ in range(M):
  h.heappush(-(-h.heappop() // 2))
for _ in range(N):
  res -= h.heappop()
print(res)
# Original solution
n, m = list(map(int, input().split()))
a = list([int(x) for x in input().split()])
 
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 = [-int(x) for x in input().split()]
heapq.heapify(a)

for i in range(m):
    l = -heapq.heappop(a)
    heapq.heappush(a, -(l//2))
    
print((-sum(a)))
# Original 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):
    l = -heapq.heappop(a)
    heapq.heappush(a, -(l//2))
    
print((-sum(a)))

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

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

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

a = list(map(int,input().split()))
res = sum(a)
dis = 0
for v in range(M):
    a.sort(reverse=True)
    dis += a[0] - a[0]//2
    a[0] //=2
print((res-dis))


# 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):
    heapq.heappush(a,((heapq.heappop(a)*(-1))//2)*(-1))
print((abs(sum(a))))
# Original solution
from queue import PriorityQueue

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

for a in A:
    queue.put(-a)

for i in range(M):
    a = -queue.get()
    a /= 2
    queue.put(-a)

ans = 0
for i in range(N):
    ans += int(-queue.get())
print(ans)


# 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):
    heappush(A, -(-heappop(A) // 2))

print((-sum(A)))
# Original solution
N, M = list(map(int, input().split()))
AS = list(map(int, input().split()))
for i in range(M):
    hi = max(list(range(N)), key = lambda n : AS[n])
    AS[hi]//=2
print((sum(AS)))


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

import math

buckets = [[] for i in range(31)]
count = [0 for i in range(31)]
for num in AS:
    buckets[math.floor(math.log(num)/math.log(2))].append(num)
    
for lst in buckets: lst.sort(reverse=True)

hi = 30
while buckets[hi-1] == []: hi -= 1
found = 0
while True:
    try:
        if M > found:
            for i in range(hi, 31):
                count[i] += 1
            hi -= 1
            M -= found
            found += len(buckets[hi])
        else:
            total = 0
            for i in range(hi):
                total += sum(buckets[i])
                
            lst = []
            for i in range(hi, 30):
                for item in buckets[i]:
                    lst.append(item // pow(2, count[i]))
             
            lst.sort(reverse=True)
            
            for i in range(M):
                lst[i] //= 2

            total += sum(lst)

            print(total)
            break
    except:
        print((0))
        break
# Original solution
import bisect
n , m = list(map(int, input().split()))
a = list(map(int,input().split()))
a.sort()

for i in range(m):
    t = a[n-1]//2
    index = bisect.bisect_left(a,t)
    a.insert(index,t)

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

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

# Optimized solution
import heapq
n, m = list(map(int, input().split()))
lst = list([-1*int(x) for x in input().split()])
heapq.heapify(lst)
for i in range(m):
  heapq.heappush(lst, -(-heapq.heappop(lst)//2))
print((-1*sum(lst)))
# Original solution
L1 = input().split(" ")
L2 = input().split(" ")
tickets = int(L1[1])
L2int = [int(s) for s in L2]

for t in range(tickets):
    M = max(L2int)
    L2int[L2int.index(M)] = M//2
print((sum(L2int)))

# Optimized solution
import heapq
 
L1 = input().split(" ")
L2 = input().split(" ")
tickets = int(L1[1])
L2int = [-int(s) for s in L2]
 
heapq.heapify(L2int)
 
for t in range(tickets):
    heapq.heappush(L2int,-(-heapq.heappop(L2int)//2))
print((-sum(L2int)))
# Original solution
N, M = list(map(int, input().split()))
li = list(map(int, input().split()))
for i in range(M):
  MAX = max(li)
  li[li.index(MAX)] = MAX // 2
print((sum(li)))


# Optimized solution
import heapq
N, M = list(map(int, input().split()))
li = list([int(x) * (-1) for x in input().split()])
heapq.heapify(li)
for i in range(M):
  max_price = heapq.heappop(li)*(-1)
  heapq.heappush(li, (-1) * (max_price // 2))
print((-sum(li)))
# Original solution
n,m = list(map(int,input().split()))
a = list(map(int,input().split()))
a.sort(reverse=True)
def move(a):
    for i in range(len(a)-1):
        if a[i] < a[i+1]:
            a[i],a[i+1] = a[i+1],a[i]
        else:
            break
    return a
for i in range(m):
    a[0] //= 2
    a = move(a)
ans = 0
for x in a:
    ans += x
print(ans)


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

for _ in range(M):
  i = A.index(max(A))
  A[i] = A[i] // 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 _ in range(M):
  a = -heapq.heappop(A)
  a = a // 2
  heapq.heappush(A, -a)

print((-sum(A)))
# Original solution
N, M = list(map(int, input().split()))
A = [int(i) for i in input().split()]
A.sort()



for i in range(M):
  A[N-1] = A[N-1] // 2
  if A[N-1] < A[N-2]:
    A.sort()
    
print((sum(A)))

# Optimized solution
import heapq

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

for i in range(M):
  h = heapq.heappushpop(A, (h*(-1))//2*(-1))
    
print(((sum(A)+h) * (-1)))
# Original solution

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

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

for i in range(M):
    A = sorted(A, reverse=True)
    A[0] = int(A[0] / 2)
    
from functools import reduce

print((reduce(lambda x, y:x + y, A)))


# Optimized solution
from heapq import heapify, heappop, heappush

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

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

print((-1 * 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))] = a[a.index(max(a))] // 2

print((sum(a)))


# Optimized solution
import heapq

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

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

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


if __name__ == "__main__":
    resolve()


# Optimized solution
import heapq


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


if __name__ == "__main__":
    resolve()
# Original solution
n,m=list(map(int,input().split()))
pricelist=list(map(int,input().split()))
for i in range(m):
    pricelist.sort(reverse=True)
    pricelist[0]//=2
print((sum(pricelist)))

# Optimized solution
#ABC-141-D
def main():
    n,m=list(map(int,input().split(" ")))
    s=list(map(int,input().split(" ")))
    
    s.sort(reverse=True)
    while m!=0:
        tmp=s[0]//2
        s[0]=tmp
        m-=1
        for j in range(1,n):
            if m==0:
                break
            else:
                if s[j]>=tmp:
                    s[j]=s[j]//2
                    m-=1
                else:
                    break
        s.sort(reverse=True)
        if s[0]==0:
            break
    print((sum(s)))
    
main()
# Original solution
import bisect
n, m = list(map(int, input().split()))
price = sorted(list(map(int, input().split())))

while m >= 1:
    new_price = price[-1] // 2
    bisect.insort_left(price, new_price)
    del price[-1]
    m -= 1
    
print((sum(price)))

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

while m >= 1:
    a = (heapq.heappop(price) + 1) // 2
    heapq.heappush(price, a)
    m -= 1
    
print((sum(price) * (-1)))
# Original solution
import bisect
n,m = [int(i) for i in input().split()]
l = sorted([int(i) for i in input().split()])
[bisect.insort(l,l[n-1]//2) for _ in range(m)]
    
print((sum(l[0:n])))

# Optimized solution
import heapq
n,m = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
h = []
for i in l:
    i = -1*i
    heapq.heappush(h,i)
    
for _ in range(m):
    v = -heapq.heappop(h)
    heapq.heappush(h,-1*(v//2))
    
print((-sum(h)))
# Original solution
N,M = list(map(int, input().split()))
A = []
for X in input().split():
	A.append(int(X))

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

sum = 0
for x in range(len(A)):
	sum += int(A[x])

print(sum)


# Optimized solution
import heapq

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

heapq.heapify(A)
for x in range(M):
	heapq.heappush(A, heapq.heappop(A)/2)
A_int = list(map(int, A))
print((-sum(A_int)))
# Original solution
import heapq


def main():
    N, M = [int(x) for x in input().split()]
    heap = [-int(x) for x in input().split()]
    heapq.heapify(heap)

    for _ in range(M):
        x = heapq.heappop(heap)
        x = -x
        x = x // 2
        x = -x
        heapq.heappush(heap, x)
    print((sum([-x for x in heap])))


if __name__ == '__main__':
    main()

# Optimized solution
import heapq


def main():
    N, M = [int(x) for x in input().split()]
    heap = [-int(x) for x in input().split()]
    heapq.heapify(heap)

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


if __name__ == '__main__':
    main()
# 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[-1] = int(a[-1] / 2)
  tmp = a[:-1]
  p = bisect.bisect_left(tmp, a[-1])
  a = tmp[:p] + [a[-1]] + tmp[p:]
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):
  tmp = int(heapq.heappop(a) / 2)
  heapq.heappush(a, tmp)
print((-1 * sum(a)))
# Original solution
N,M = list(map(int,input().split()))
list_A = list(map(int,input().split()))
for i in range(M):
    A = max(list_A)
    list_A.remove(A)
    list_A.append(A // 2)
print((sum(list_A)))

# Optimized solution
N,M=list(map(int,input().split()))
import sys
A= list(map(int,sys.stdin.readline().split()))
A=[i*-1 for i in A]
import heapq
heapq.heapify(A)
for i in range(M):
    X=heapq.heappop(A)
    X=abs(X)//2*-1
    heapq.heappush(A,X)
print((abs(sum(A))))
# Original solution
N,M = list(map(int, input().split()))
money = list(map(int, input().split()))
 
for i in range(M):
  money[money.index(max(money))]//=2
 
print((sum(money)))

# Optimized solution
import heapq

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

heapq.heapify(b)

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

print((-sum(b)))
# Original solution
n,m = list(map(int, input().split()))
lst = list(map(int, input().split()))
# lst.sort(reverse=True)

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

    # if lst[0]<lst[1]:
    #     lst[0],lst[1]=lst[1],lst[0]
print((sum(lst)))


# Optimized solution
import heapq

n,m = list(map(int, input().split()))
lst = [-int(i) for i in input().split()]
heapq.heapify(lst)

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

"""
A.sort(reverse=True)

for m in range(M):
    A[m] //= 2
    A.sort()
    #print(A)

print(sum(A))
"""

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

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)

#print(A)

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

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, M= list(map(int, input().split()))
A = list(map(int, input().split()))
a=[-1*i for i in A]
heapq.heapify(a)
for i in range(M):
    m=int(heapq.heappop(a)/2)
    heapq.heappush(a, m)

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

for i in range(M):
    s = A_sorted[:i+1]
    A_sorted[A_sorted.index(max(s))] /= 2 

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

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

print((-sum(A)))
# Original solution
def main():
    N, M = list(map(int, input().split()))
    A_i = list(map(int, input().split()))
    for i in range(M):
        m = max(A_i)
        A_i.remove(m)
        m = m//2
        A_i.append(m)
    print((sum(A_i)))


main()


# Optimized solution
import heapq


def main():
    N, M = list(map(int, input().split()))
    A_i = list([-int(x) for x in input().split()])
    heapq.heapify(A_i)
    for i in range(M):
        m = -heapq.heappop(A_i)
        m = m//2
        heapq.heappush(A_i, -m)
    print((-sum(A_i)))


main()
# Original solution
from collections import deque
import bisect
import math
N, M = list(map(int, input().split()))

A = sorted([-int(_) for _ in input().split()])
deq = deque(A)

for m in range(M):
    div = deq.popleft()
    div = math.ceil(div / 2)
    tmp_lis = list(deq)
    #print(tmp_lis)
    bisect.insort(tmp_lis, div)
    deq = deque(tmp_lis)
print((-sum(deq)))

# Optimized solution
import heapq

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

tmp = 0
for m in range(M):
    div = -heapq.heappop(A)
    div = div // 2
    heapq.heappush(A, -div)
print((-sum(A)))
# Original solution
n,m=list(map(int,input().split()))
A=list(map(int,input().split()))
while m>0:
    max=0
    num=0
    for i in range(n):
        if A[i]>max:
            max=A[i]
            num=i
    A[num]=A[num]/2
   # print(num+1)
    m+=-1
sum=0
for a in A:
    #print(a)
    sum+=(a//1)
print((int(sum)))
    


# Optimized solution
import heapq
n,m=list(map(int,input().split()))
def func(x):
    return -1*int(x)
A=list(map(func,input().split()))
#print(A)
heapq.heapify(A)
while m>0:
    x=heapq.heappop(A)
    x/=2
    heapq.heappush(A,x)
    m+=-1
sum=0
for a in A:
    #print((-1*a)//1)
    sum+=((-1*a)//1)
print((int(sum)))
# Original solution
def main():
    import bisect
    import math
    import sys

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

if __name__ == '__main__':
    main()


# Optimized solution
def main():
    import bisect
    import math
    import sys
    import heapq
    def f(s):
        return -int(s)

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

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

    print((-sum(a)))
    

if __name__ == '__main__':
    main()
# Original solution
from bisect import insort_left
N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
A.sort()
for i in range(M):
    A[-1] = A[-1]/2
    k = A[-1]
    A = A[:-1]
    insort_left(A,k)
s = 0
for i in range(N):
    s += int(A[i])
print(s)

# 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 = heapq.heappop(A)
    a /= 2
    heapq.heappush(A,a)
s = 0
for i in A:
    i = int(i*(-1))
    s += i
print(s)
# Original solution
import bisect

n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
for i in range(m):
    test = a.pop(-1)
    bisect.insort(a, test // 2)
print((sum(a)))

# Optimized solution
import heapq

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

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

alog0=math.log2(alist[0])
alist_log=[]
diff_list=[]
for i in range(N):
  a=alist[i]
  alogi=math.log2(a)  
  alist_log.append(alogi)

#print(alist)
#print(alist_log)

tlist=[0]*N
while(M>0):
  max_value=max(alist_log)
  max_index=alist_log.index(max_value)
  
  alist_log[max_index]-=1
  tlist[max_index]+=1
  M-=1
#print(tlist)

answer=0
for i in range(N):
  answer+=alist[i]//(2**tlist[i])

print(answer)

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

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

hq=[]
for a in alist:
  heapq.heappush(hq,-a)
  
while(M>0):
  target=-1*heapq.heappop(hq)
  target//=2
  heapq.heappush(hq,-target)
  M-=1

answer_list=[heapq.heappop(hq) for i in range(len(hq))]
#print(answer_list)
print((-sum(answer_list)))