import sys
input = sys.stdin.readline
import heapq

N, M = map(int, input().split())
A = list(map(int, input().split()))
A_dic = {} #value: idx
for i in range(N):
    if A[i] not in A_dic:
        A_dic[A[i]] = []
    A_dic[A[i]].append(i)

# その時の最大のAに１つ使う　これを繰り返す
total = 0
rest = M
if N == 1:
    while rest > 0:
        rest -= 1
        A[0] //= 2
    total = A[0]
elif N == 2:
    while rest > 0:
        rest -= 1
        if A[0] >= A[1]:
            A[0] //= 2
        else:
            A[1] //= 2
    total = A[0] + A[1]
else:
    hq = [-A[i] for i in range(N)]
    heapq.heapify(hq)
    while rest > 0:
    #     temp_idx = A_items[0][1]
    #     while A_items[0][0] >= A_items[1][0]:
    #         rest -= 1
    #         A_items[0][0] //= 2
    #         A[temp_idx] //= 2
    #     idx = 2
    #     while A_items[0][0] < A_items[idx][0]:
    #         idx += 1
    #         if idx >= N-1:
    #             break
    #     u, v = A_items[0], A_items[idx-1]
    #     A_items[idx-1] = u
    #     A_items[0] = v
    # total = sum(A)
        
        max_v = heapq.heappop(hq) * (-1)
        max_idx = A_dic[max_v].pop()
        A[max_idx] //= 2
        if max_v//2 not in A_dic:
            A_dic[max_v//2] = []
        A_dic[max_v//2].append(max_idx)
        heapq.heappush(hq, (max_v//2) * (-1))
        rest -= 1
    total = sum(A)
    


print(total) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline import heapq heapq N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M A = list(map(int, input().split())) A list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split A_dic = {} A_dic {} for i in range(N):
    if A[i] not in A_dic:
        A_dic[A[i]] = []
    A_dic[A[i]].append(i)

# その時の最大のAに１つ使う　これを繰り返す i range(N) range N if A[i] not in A_dic:
        A_dic[A[i]] = []
     A[i] not in A_dic A[i] A i A_dic A_dic[A[i]] = [] A_dic[A[i]] A_dic A[i] A i [] A_dic[A[i]].append(i) [A[i]].append [A[i]] A_dic A[i] A i append i total = 0 total 0 rest = M rest M if N == 1:
    while rest > 0:
        rest -= 1
        A[0] //= 2
    total = A[0]
elif N == 2:
    while rest > 0:
        rest -= 1
        if A[0] >= A[1]:
            A[0] //= 2
        else:
            A[1] //= 2
    total = A[0] + A[1]
else:
    hq = [-A[i] for i in range(N)]
    heapq.heapify(hq)
    while rest > 0:
    #     temp_idx = A_items[0][1]
    #     while A_items[0][0] >= A_items[1][0]:
    #         rest -= 1
    #         A_items[0][0] //= 2
    #         A[temp_idx] //= 2
    #     idx = 2
    #     while A_items[0][0] < A_items[idx][0]:
    #         idx += 1
    #         if idx >= N-1:
    #             break
    #     u, v = A_items[0], A_items[idx-1]
    #     A_items[idx-1] = u
    #     A_items[0] = v
    # total = sum(A)
        
        max_v = heapq.heappop(hq) * (-1)
        max_idx = A_dic[max_v].pop()
        A[max_idx] //= 2
        if max_v//2 not in A_dic:
            A_dic[max_v//2] = []
        A_dic[max_v//2].append(max_idx)
        heapq.heappush(hq, (max_v//2) * (-1))
        rest -= 1
    total = sum(A)
     N == 1 N 1 while rest > 0:
        rest -= 1
        A[0] //= 2
     rest > 0 rest 0 rest -= 1 rest 1 A[0] //= 2 A[0] A 0 2 total = A[0] total A[0] A 0 elif N == 2:
    while rest > 0:
        rest -= 1
        if A[0] >= A[1]:
            A[0] //= 2
        else:
            A[1] //= 2
    total = A[0] + A[1] N == 2 N 2 while rest > 0:
        rest -= 1
        if A[0] >= A[1]:
            A[0] //= 2
        else:
            A[1] //= 2
     rest > 0 rest 0 rest -= 1 rest 1 if A[0] >= A[1]:
            A[0] //= 2
        else:
            A[1] //= 2
     A[0] >= A[1] A[0] A 0 A[1] A 1 A[0] //= 2 A[0] A 0 2 A[1] //= 2 A[1] A 1 2 total = A[0] + A[1] total A[0] + A[1] A[0] A 0 A[1] A 1 -A[i] for i in range(N) for i in range(N) i range(N) range N for i in range(N) -A[i] A[i] A i hq = [-A[i] for i in range(N)] hq [-A[i] for i in range(N)] heapq.heapify(hq) heapq.heapify heapq heapify hq while rest > 0:
    #     temp_idx = A_items[0][1]
    #     while A_items[0][0] >= A_items[1][0]:
    #         rest -= 1
    #         A_items[0][0] //= 2
    #         A[temp_idx] //= 2
    #     idx = 2
    #     while A_items[0][0] < A_items[idx][0]:
    #         idx += 1
    #         if idx >= N-1:
    #             break
    #     u, v = A_items[0], A_items[idx-1]
    #     A_items[idx-1] = u
    #     A_items[0] = v
    # total = sum(A)
        
        max_v = heapq.heappop(hq) * (-1)
        max_idx = A_dic[max_v].pop()
        A[max_idx] //= 2
        if max_v//2 not in A_dic:
            A_dic[max_v//2] = []
        A_dic[max_v//2].append(max_idx)
        heapq.heappush(hq, (max_v//2) * (-1))
        rest -= 1
     rest > 0 rest 0 max_v = heapq.heappop(hq) * (-1) max_v heapq.heappop(hq) * (-1) heapq.heappop(hq) heapq.heappop heapq heappop hq -1 max_idx = A_dic[max_v].pop() max_idx A_dic[max_v].pop() [max_v].pop [max_v] A_dic max_v pop A[max_idx] //= 2 A[max_idx] A max_idx 2 if max_v//2 not in A_dic:
            A_dic[max_v//2] = []
         max_v//2 not in A_dic max_v//2 max_v 2 A_dic A_dic[max_v//2] = [] A_dic[max_v//2] A_dic max_v//2 max_v 2 [] A_dic[max_v//2].append(max_idx) [max_v//2].append [max_v//2] A_dic max_v//2 max_v 2 append max_idx heapq.heappush(hq, (max_v//2) * (-1)) heapq.heappush heapq heappush hq (max_v//2) * (-1) max_v//2 max_v 2 -1 rest -= 1 rest 1 total = sum(A) total sum(A) sum A print(total) print total max_idx = A_dic[max_v].pop() A_dic[max_v].pop() max_idx total = sum(A) sum(A) total M = map(int, input().split()) map(int, input().split()) M input = sys.stdin.readline sys.stdin.readline input N, M = map(int, input().split()) map(int, input().split()) N hq = [-A[i] for i in range(N)] [-A[i] for i in range(N)] hq rest -= 1 1 rest total = 0 0 total A_dic = {} {} A_dic total = A[0] A[0] total rest = M M rest rest -= 1 1 rest rest -= 1 1 rest max_v = heapq.heappop(hq) * (-1) heapq.heappop(hq) * (-1) max_v total = A[0] + A[1] A[0] + A[1] total A = list(map(int, input().split())) list(map(int, input().split())) A
import sys
input = sys.stdin.readline
import heapq

N, M = map(int, input().split())
A = list(map(int, input().split()))
A_dic = {} #value: idx
for i in range(N):
    if A[i] not in A_dic:
        A_dic[A[i]] = []
    A_dic[A[i]].append(i)

# その時の最大のAに１つ使う　これを繰り返す
total = 0
rest = M
if N == 1:
    while rest > 0:
        rest -= 1
        A[0] //= 2
    total = A[0]
elif N == 2:
    while rest > 0:
        rest -= 1
        if A[0] >= A[1]:
            A[0] //= 2
        else:
            A[1] //= 2
    total = A[0] + A[1]
else:
    hq = [-A[i] for i in range(N)]
    heapq.heapify(hq)
    while rest > 0:
    #     temp_idx = A_items[0][1]
    #     while A_items[0][0] >= A_items[1][0]:
    #         rest -= 1
    #         A_items[0][0] //= 2
    #         A[temp_idx] //= 2
    #     idx = 2
    #     while A_items[0][0] < A_items[idx][0]:
    #         idx += 1
    #         if idx >= N-1:
    #             break
    #     u, v = A_items[0], A_items[idx-1]
    #     A_items[idx-1] = u
    #     A_items[0] = v
    # total = sum(A)
        
        max_v = heapq.heappop(hq) * (-1)
        max_idx = A_dic[max_v].pop()
        A[max_idx] //= 2
        if max_v//2 not in A_dic:
            A_dic[max_v//2] = []
        A_dic[max_v//2].append(max_idx)
        heapq.heappush(hq, (max_v//2) * (-1))
        rest -= 1
    total = sum(A)
    


print(total)