CodeEff/ECCO huggingface dataset:
# Original solution
m = list(map(int,input().split()))
a = list(map(int,input().split()))

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

print((sum(a)))

# Optimized solution
import heapq

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

heapq.heapify(a)

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

print((sum(a)*-1))
# Original solution
import bisect


def main():
    n, m = list(map(int, input().split(' ')))
    a_s = list(sorted(map(int, input().split(' '))))
    
    for _ in range(m):
        value = int(a_s[n-1]/2)
        i = bisect.bisect_left(a_s[:n-1], value)
        a_s[i+1:n] = a_s[i:n-1]
        a_s[i] = value
    print((sum(a_s)))


if __name__ == '__main__':
    main()


# Optimized solution
import heapq


def main():
    n, m = list(map(int, input().split(' ')))
    a_s = list(sorted([-1 * int(x) for x in input().split(' ')]))

    heapq.heapify(a_s)
    for _ in range(m):
        e = heapq.heappop(a_s)
        heapq.heappush(a_s, int(e/2))
    print((-1*sum(a_s)))
    
    

if __name__ == '__main__':
    main()
# Original solution
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
"""
high = float('inf')
low = -1

while low + 1 < high:
  mid = (low + high) // 2
  
  if min(sum(a), mid  :
    high = mid
  else:
    low = mid
print(high)
"""
for i in range(m):
  a[a.index(max(a))] = int(a[a.index(max(a))] / 2)
print((sum(a)))

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

import heapq
a = [-i for i in a]

heapq.heapify(a)
for i in range(m):
  b = heapq.heappop(a) * (-1)
  heapq.heappush(a, b // 2 * (-1))
print((-sum(a)))
# Original solution
def mmm(li):
    li[li.index(max(a))]//=2

n,m = list(map(int,input().split()))
a=  list(map(int,input().split()))
[mmm(a) for i in range(m)]
print((sum(a)))

# Optimized solution
import heapq
n,m = list(map(int,input().split()))
a=  list(map(int,input().split()))
h = list([-1*x for x in a])
heapq.heapify(h)
for i in range(m):
    heapq.heapreplace(h,-(-h[0]//2))
print((-1*sum(h)))
# 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] //= 2

print((sum(a)))

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

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

print((sum(int(-x) for x in a)))

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

for i in range(m):
    a_max = max(a)
    a_max_i = a.index(a_max)
    new = int(a_max / 2) if not a_max == 0 else 0
    a[a_max_i] = new

print((int(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):
    a_min = heapq.heappop(a)
    heapq.heappush(a, int(a_min / 2))

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

# Optimized solution
import math
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 i in range(m):
    min = (-1)*((-1)*(heapq.heappop(A))//2)
    heapq.heappush(A, min)


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

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

print((sum(A)))

# Optimized solution
import heapq

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

heapq.heapify(A)

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

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

A.sort(reverse=True)
#print(A)

B=A[0:min(N,M)]

for i in range(M):
    idx = B.index(max(B))

    B[idx] = int(B[idx] / 2.0)
#    A.sort(reverse=True)

ans = 0
for i in range(N):
    if i < len(B):
        ans+=B[i]
    else:
        ans += A[i]

print(ans)

# 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 j in range(M):
    a = heapq.heappop(A)
    b = -1*((-a) // 2)
    heapq.heappush(A,b)

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

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

    used = 0
    while used < M:
        ma = max(A)
        idx = A.index(ma)
        A[idx] = A[idx] // 2
        used += 1
    print((sum(A)))


    # TLE
    # for _ in range(M):
    #     A.sort()
    #     A[-1] = A[-1] // 2
    # print(sum(A))


if __name__ == "__main__":
    main()


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

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


if __name__ == "__main__":
    main()
# Original solution
import bisect
N, M = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
for i in range(M):
    p = A.pop()
    p //= 2
    index = bisect.bisect_left(A, p)
    A.insert(index, p)
print((sum(A)))

# Optimized solution
import heapq
import bisect
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
A = [(-x, x) for x in A]
heapq.heapify(A)
for i in range(M):
    P = heapq.heappop(A)
    p = P[1] // 2
    heapq.heappush(A, (-p, p))
s = 0
for i in range(N):
    s += A[i][1]
print(s)
# Original solution
N, M = list(map(int, input().split()))
A = [int(x) for x in input().split()]
A = sorted(A)[::-1]
res = 0
for x in A:
    res += x
for m in range(M):
    tmp = sorted(A[:m+1])[::-1]
    k = tmp[0]
    tmp[0] = int(tmp[0]/2)
    l = tmp[0]
    tmp.extend(A[m+1:])
    A = tmp
    res -= k-l

print(res)


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

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

arr.sort()

for _ in range(m):
    q = arr.pop()
    bisect.insort_right(arr, q // 2)

print((sum(arr)))

# Optimized solution
from heapq import heapify, heapreplace

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

for _ in range(m):
    heapreplace(arr, int(arr[0] / 2))

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

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

for _ in range(m):
    tmp = heappop(arr)
    heappush(arr, int(tmp / 2))

print((-sum(arr)))

# Optimized solution
from heapq import heappop, heappush, heapify

n, m = list(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)))
# Original solution
import heapq

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

heapq.heapify(A)

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

    M-=1
print((-sum(A)))

# Optimized solution
import heapq

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

q=[]
for aa in a:
    heapq.heappush(q,-aa)

while m>0:
    aa=heapq.heappop(q)
    heapq.heappush(q,-((-aa)//2))
    m-=1

print((-sum(q)))
# Original solution
N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
while M > 0:
    M -= 1
    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)  # aを優先度付きキューに

for _ in range(m):
    tmp_min = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-tmp_min//2))  # 計算誤差の関係で-1を2回かけてます
print((-sum(a)))
# Original solution
n, m = [int(i) for i in input().split()]
prices = sorted([int(i) for i in input().split()], reverse=True)
for i in range(m):
	prices[0] = prices[0] // 2
	prices = sorted(prices, reverse=True)
print((sum(prices)))

# Optimized solution
n, m = [int(i) for i in input().split()]
prices = sorted([int(i) for i in input().split()], reverse=True)
d = 1
while(True):
	d *= 2
	if d * 2 > 10 ** 9:
		break
while(d > 0):
	for i, price in enumerate(prices):
		if price >= d:
			prices[i] = prices[i] // 2
			m -= 1
			if m == 0:
				d = 0
				break
	prices = sorted(prices, reverse=True)
	d /= 2
print((sum(prices)))
# Original solution
N = int(2e5+3)
heap_arr, heap_size = [0] * N, 0

def heap_push(x):
    global heap_size
    heap_arr[heap_size] = x
    i = heap_size
    while i > 0 and heap_arr[i] > heap_arr[(i-1)//2]:
        heap_arr[i], heap_arr[(i-1)//2] = heap_arr[(i-1)//2], heap_arr[i]
        i = (i-1)//2
    heap_size += 1

def get_max():
    global heap_size
    if heap_size == 0:
        return -2e9
    return heap_arr[0]

def heap_pop():
    global heap_size
    if heap_size == 0:
        return
    heap_size -= 1
    heap_arr[0], heap_arr[heap_size] = heap_arr[heap_size], heap_arr[0]
    i, j = 0, -1
    while i != j:
      j = i
      l = 2*i+1
      r = 2*i+2
      if l < heap_size and heap_arr[l] > heap_arr[i]:
          i = l
      if r < heap_size and heap_arr[r] > heap_arr[i]:
          i = r
      heap_arr[i], heap_arr[j] = heap_arr[j], heap_arr[i]

n, m = list(map(int, input().split()))
arr = list(map(int, input().split()))
for i in arr:
    heap_push(i)
while m >= 1:
    x = get_max() // 2
    heap_pop()
    heap_push(x)
    m -= 1    
print((sum(heap_arr)))


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

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

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


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

ans = 0
for i in range(n):
    ans += int(-a[i])

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

# Optimized solution
import heapq as hq

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

A = []
for a in [int(_) for _ in input().split()]:
    hq.heappush(A, -a)

for _ in range(m):
    t = hq.heappop(A)
    hq.heappush(A, t / 2)
print((-sum([int(a) for a in A])))
# Original solution
n, m = list(map(int, input().split()))
arr = list(map(int, input().split()))
for _ in range(m):
    _max = max(arr)
    i = arr.index(_max)
    arr[i] = _max // 2
print((sum(arr)))

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

b = arr[0] // 2
i = 0
while True:
    if m == 0:
        break
    if b <= arr[i]:
        arr[i] = arr[i] // 2
        m -= 1
    else:
        arr = sorted(arr, reverse=True)
        i = 0
        b = arr[0] // 2
        continue
    if i < n-1:
        i += 1
    else:
        i = 0

print((sum(arr)))
# Original solution
import sys
from io import StringIO
import unittest


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

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

    print((int(sum(A))))


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3 3
2 13 8"""
        output = """9"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """4 4
1 9 3 5"""
        output = """6"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """1 100000
1000000000"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """10 1
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000"""
        output = """9500000000"""
        self.assertIO(input, output)


if __name__ == "__main__":
    resolve()


# Optimized solution
import sys
from io import StringIO
import unittest
import heapq


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

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

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


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3 3
2 13 8"""
        output = """9"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """4 4
1 9 3 5"""
        output = """6"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """1 100000
1000000000"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """10 1
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000"""
        output = """9500000000"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()
# Original solution
N, M = list(map(int, input().split()))
A_lis = list(map(int, input().split()))
#A_lis.sort()

def discount(B_lis,delta):
    #B_lis.sort()
    max_index = B_lis.index(max(B_lis))
    delta[max_index] += B_lis[max_index]/2
    B_lis[max_index] = B_lis[max_index]/2
    #B_lis.sort()
    return B_lis,delta

dis = [0]*N
for i in range(M):
    A_lis,dis = discount(A_lis,dis)
    #print(A_lis)
    #print(dis)

ans = 0
for i in range(len(A_lis)):
    ans+=int(A_lis[i])
print(ans)


# Optimized solution
import heapq

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

heapq.heapify(A_lis)

def discount(A_lis):
    popped = heapq.heappop(A_lis)
    heapq.heappush(A_lis,popped/2)
    return A_lis

for i in range(M):
    A_lis = discount(A_lis)
ans = 0
for i in A_lis:
    ans += int(i)
print((ans*(-1)))
# Original solution
import heapq

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

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

for i in range(M):
    A = heapsort(A)
    A[N-1] //= 2

print((sum(A)))

# Optimized solution
import heapq
import math

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

# 各要素に1掛ける
A = list([x * -1 for x in A])
heapq.heapify(A)

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

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

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

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

while M != 0:
  max_ = -heapq.heappop(A) // 2
  heapq.heappush(A, -max_)
  M -= 1
  
print((-sum(A)))
# Original solution
N, M = list(map(int, input().split()))
A = list(map(float, input().split()))

for _ in range(M):
    i = max(list(range(len(A))), key=A.__getitem__)
    A[i] /= 2
A = list(map(int, A))
print((sum(A)))


# Optimized solution
import heapq

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

heap = [-Ai for Ai in A]
heapq.heapify(heap)
for _ in range(M):
    heapq.heapreplace(heap, heap[0]/2)
A = [int(-p) for p in heap]
print((sum(A)))
# Original solution
import bisect
N,M=[int(i) for i in input().split()]
A = sorted([int(i) for i in input().split()])
for i in range(M):
  A2=A[N-1]//2
  A.pop(N-1)
  A.insert(bisect.bisect_left(A, A2), A2)
print((sum(A)))


# Optimized solution
import heapq
N,M=[int(i) for i in input().split()]
A=sorted([-int(i) for i in input().split()])
for i in range(M):heapq.heappush(A,-(-heapq.heappop(A)//2))
print((-sum(A)))
# Original solution
#!/usr/bin/env python3
import sys
import heapq

def solve(N: int, M: int, A: "List[int]"):
    a = []
    for i in A:
        heapq.heappush(a, -i)

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

    sum = 0
    for i in a:
        sum += i
    print((-sum))
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, M, A)

if __name__ == '__main__':
    main()


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

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

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

    sum = 0
    for i in a:
        sum += i
    print((-sum))
    return 

if __name__ == '__main__':
    main()
# Original solution
import sys
import bisect
sys.setrecursionlimit(10 ** 9)
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

_, M = lr()
A = lr()

A.sort()
for m in range(M):
    a = A[-1] // 2
    i = bisect.bisect_left(A, a)
    A.insert(i, a)
    A = A[:-1]
print((sum(A)))


# Optimized solution
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

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

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

print((sum(a)))

# Optimized solution
import heapq
import math

n, m = list(map(int, input().split()))
a = [-1*int(x) for x in input().split()]
heapq.heapify(a)
 
for _ in range(m):
    min_a = heapq.heappop(a)
    heapq.heappush(a, math.ceil(min_a / 2))
    
print((sum(a)*(-1)))
# Original solution
n,m = list(map(int, input().split()))
L=list(map(int, input().split()))
L.sort(reverse=True)

for i in range(m):
	L[0]=L[0]/2
	for j in range(n-1):
		if L[j]<L[j+1]:
			L[j], L[j+1]= L[j+1], L[j]
		else:
			break
#小数点を切り捨てる
for i in range(n):
	L[i]=int(L[i])
print((sum(L)))

# Optimized solution
n, m = list(map(int, input().split()))
L=list(map(int, input().split()))
A=[]
for i in range(n):
	A.append(-L[i])

import heapq
heapq.heapify(A)

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

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

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

print((sum(A_list)))

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

import heapq, math
A_list = [-x for x in A_list]
heapq.heapify(A_list)

for _ in range(M):
    A_min = heapq.heappop(A_list)
    heapq.heappush(A_list, math.ceil(A_min/2))

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

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

# list内の最も大きい数字を2で割るのをm回行う
for i in range(m):
    a = sorted(a)
    a[n -1] = int(a[n -1] / 2)

print((sum(a)))

# Optimized solution
import heapq

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

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

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

print((sum(a) * -1))
# Original solution
import math
N,Y=list(map(int,input().split()))
a=[float(x) for x in input().split()]
for b in range(Y):
  a.sort(reverse=True)
  a[0]=float(a[0])/2
v=0
for c in range(N):
  v+=int(a[c])
print(v)

  


# Optimized solution
import heapq

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

heapq.heapify(A)

for i in range(M):
    A_max=heapq.heappop(A)*-1
    heapq.heappush(A,(A_max//2)*-1)    
print((sum(A)*-1))
# Original solution
import heapq

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

while M > 0:
    heapq.heapify(A)
    count = (heapq.heappop(A) * -1 // 2) * -1

    heapq.heappush(A, count)
    M -= 1

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


# Optimized solution
import heapq

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

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

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

for _ in range(M):
    max_i = A.index(max(A))
    A[max_i] >>= 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):
  v = heapq.heappop(A) * (-1)
  heapq.heappush(A, -(v >> 1))

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

from math import floor

def bubble(x):
	for i in range(len(x)-1):
		if x[i] < x[i+1]:
			x[i], x[i+1] = x[i+1], x[i]
		else:
			break

	return x

a.sort(reverse=True)

for _ in range(m):
	a[0] /= 2
	a = bubble(a)

ans = 0
for ele in a:
	ans += floor(ele)

print(ans)

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

from math import floor
import heapq

for i in range(n):
	a[i] = -a[i]

h = []
for ele in a:
	heapq.heappush(h, ele)

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

ans = 0
for ele in h:
	ans += floor(-ele)

print(ans)
# Original solution
N, M = list(map(int, input().split()))
A = sorted(list(map(int, input().split())), reverse=True)
for i in range(M):
    A[0] = int(A[0] / 2)
    A = sorted(A, reverse=True)
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):
    a = -int(heapq.heappop(A) / 2)
    heapq.heappush(A, -a)
print((-sum(A)))