import math

N,M=[int(s) for s in input().split()]

ls=[int(s) for s in input().split()]

ls.sort(reverse=True)

x=ls[0]

L=int(math.log2(x))

#2**L より大きいものをわける

def cut(lst,exp):

    for ii in range(len(lst)):

        if ii+1==len(lst):

            break

        if lst[ii+1]<exp:

           break

    return ii

m=M #残り回数

b=-1

ls3=[]

while True:

    if m==0:

        break

    a=b+1

    b=cut(ls,2**L)

    ls2=ls[a:b+1]

    ls3=ls3+ls2

    ls3.sort(reverse=True)

    for j in range(len(ls3)):

        ls3[j]=ls3[j]//2

        m-=1

        if m==0:

            break

    L-=1

#    print(ls3,m,b)

#print(ls3,ls[b+1:])

s=sum(ls3)+sum(ls[b+1:])

print(s)

    
import math

N,M=[int(s) for s in input().split()]

ls=[int(s) for s in input().split()]

ls.sort(reverse=True)

x=ls[0]

L=int(math.log2(x))

#2**L より大きいものをわける

def cut(lst,exp):

    for ii in range(len(lst)):

        if ii+1==len(lst):

            break

        if lst[ii+1]<exp:

           break

    return ii

m=M #残り回数

b=-1

ls3=[]

while True:

    if m==0:

        break

    a=b+1

    b=cut(ls,2**L)

    ls2=ls[a:b+1]

    ls3=ls3+ls2

    if ls2!=[]:

        ls3.sort(reverse=True)

    for j in range(len(ls3)):

        ls3[j]=ls3[j]//2

        m-=1

        if m==0:

            break

    L-=1

#    print(ls3,m,b)

#print(ls3,ls[b+1:])

s=sum(ls3)+sum(ls[b+1:])

print(s)

    
import math

N, M = [int(s) for s in input().split()]
ls = [int(s) for s in input().split()]
ls.sort(reverse=True)
x = ls[0]
L = int(math.log2(x))
# 2**L より大きいものをわける
def cut(lst, exp):
    for ii in range(len(lst)):
        if ii + 1 == len(lst):
            break
        if lst[ii + 1] < exp:
            break
    return ii


m = M  # 残り回数
b = -1
ls3 = []
while True:
    if m == 0:
        break
    a = b + 1
    b = cut(ls, 2**L)
    ls2 = ls[a : b + 1]
    ls3 = ls3 + ls2
    ls3.sort(reverse=True)
    for j in range(len(ls3)):
        ls3[j] = ls3[j] // 2
        m -= 1
        if m == 0:
            break
    L -= 1
#    print(ls3,m,b)
# print(ls3,ls[b+1:])
s = sum(ls3) + sum(ls[b + 1 :])
print(s)

import math

N, M = [int(s) for s in input().split()]
ls = [int(s) for s in input().split()]
ls.sort(reverse=True)
x = ls[0]
L = int(math.log2(x))
# 2**L より大きいものをわける
def cut(lst, exp):
    for ii in range(len(lst)):
        if ii + 1 == len(lst):
            break
        if lst[ii + 1] < exp:
            break
    return ii


m = M  # 残り回数
b = -1
ls3 = []
while True:
    if m == 0:
        break
    a = b + 1
    b = cut(ls, 2**L)
    ls2 = ls[a : b + 1]
    ls3 = ls3 + ls2
    if ls2 != []:
        ls3.sort(reverse=True)
    for j in range(len(ls3)):
        ls3[j] = ls3[j] // 2
        m -= 1
        if m == 0:
            break
    L -= 1
#    print(ls3,m,b)
# print(ls3,ls[b+1:])
s = sum(ls3) + sum(ls[b + 1 :])
print(s)

-    ls3.sort(reverse=True) +    if ls2 != []: +        ls3.sort(reverse=True)