def pushHeap(array, elem):

    n = len(array)

    array.append(elem)

    while n != 0:

        i = int((n - 1) / 2)

        if array[n] > array[i]:

            tmp = array[n]

            array[n] = array[i]

            array[i] = tmp

        n = i





def popHeap(array):

    n = len(array) - 1

    array[0] = array[n]

    del array[-1]

    i = 0

    while 2 * i + 1 < n:

        j = 2 * i + 1

        if j != n - 1 and array[j] < array[j + 1]:

            j += 1

        if array[i] < array[j]:

            tmp = array[j]

            array[j] = array[i]

            array[i] = tmp

        i = j





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

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

heap_A = []



for a in A:

    pushHeap(heap_A, a)



for _ in range(M):

    discount_max = int(heap_A[0] / 2)

    popHeap(heap_A)

    pushHeap(heap_A, discount_max)



print((sum(heap_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):

    a_min = heapq.heappop(A)

    heapq.heappush(A, -1 * (-a_min//2))



print((-sum(A)))

def pushHeap(array, elem):
    n = len(array)
    array.append(elem)
    while n != 0:
        i = int((n - 1) / 2)
        if array[n] > array[i]:
            tmp = array[n]
            array[n] = array[i]
            array[i] = tmp
        n = i


def popHeap(array):
    n = len(array) - 1
    array[0] = array[n]
    del array[-1]
    i = 0
    while 2 * i + 1 < n:
        j = 2 * i + 1
        if j != n - 1 and array[j] < array[j + 1]:
            j += 1
        if array[i] < array[j]:
            tmp = array[j]
            array[j] = array[i]
            array[i] = tmp
        i = j


N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
heap_A = []
for a in A:
    pushHeap(heap_A, a)
for _ in range(M):
    discount_max = int(heap_A[0] / 2)
    popHeap(heap_A)
    pushHeap(heap_A, discount_max)
print((sum(heap_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):
    a_min = heapq.heappop(A)
    heapq.heappush(A, -1 * (-a_min // 2))
print((-sum(A)))

-def pushHeap(array, elem): -    n = len(array) -    array.append(elem) -    while n != 0: -        i = int((n - 1) / 2) -        if array[n] > array[i]: -            tmp = array[n] -            array[n] = array[i] -            array[i] = tmp -        n = i - - -def popHeap(array): -    n = len(array) - 1 -    array[0] = array[n] -    del array[-1] -    i = 0 -    while 2 * i + 1 < n: -        j = 2 * i + 1 -        if j != n - 1 and array[j] < array[j + 1]: -            j += 1 -        if array[i] < array[j]: -            tmp = array[j] -            array[j] = array[i] -            array[i] = tmp -        i = j - +import heapq -A = list(map(int, input().split())) -heap_A = [] -for a in A: -    pushHeap(heap_A, a) +A = list([int(x) * -1 for x in input().split()]) +heapq.heapify(A) -    discount_max = int(heap_A[0] / 2) -    popHeap(heap_A) -    pushHeap(heap_A, discount_max) -print((sum(heap_A))) +    a_min = heapq.heappop(A) +    heapq.heappush(A, -1 * (-a_min // 2)) +print((-sum(A)))