n,m = map(int,input().split())
a = list(map(int,input().split()))
M = max(a)
a = sorted(a,reverse=True)
t = 0
while M > 1:
    M = -(-M//2)
    t += 1
z = [[] for i in range(t+2)]
for i in range(n):
    s = 0
    b = a[i]
    while b > 1:
        b = -(-b//2)
        s += 1
    z[t-s].append(a[i])
count = 0
for i in range(t+1):
    z[i] = sorted(z[i])
    if count > m:
        break
    while z[i]:
        if count >= m:
            break
        c = z[i].pop()
        z[i+1].append(c//2)
        count += 1
ans = 0
for A in z:
    ans += sum(A)
print(ans) 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 M = max(a) M max(a) max a a = sorted(a,reverse=True) a sorted(a,reverse=True) sorted a reverse=True reverse True t = 0 t 0 while M > 1:
    M = -(-M//2)
    t += 1 M > 1 M 1 M = -(-M//2) M -(-M//2) -M//2 -M M 2 t += 1 t 1 [] for i in range(t+2) for i in range(t+2) i range(t+2) range t+2 t 2 for i in range(t+2) [] z = [[] for i in range(t+2)] z [[] for i in range(t+2)] for i in range(n):
    s = 0
    b = a[i]
    while b > 1:
        b = -(-b//2)
        s += 1
    z[t-s].append(a[i]) i range(n) range n s = 0 s 0 b = a[i] b a[i] a i while b > 1:
        b = -(-b//2)
        s += 1
     b > 1 b 1 b = -(-b//2) b -(-b//2) -b//2 -b b 2 s += 1 s 1 z[t-s].append(a[i]) [t-s].append [t-s] z t-s t s append a[i] a i count = 0 count 0 for i in range(t+1):
    z[i] = sorted(z[i])
    if count > m:
        break
    while z[i]:
        if count >= m:
            break
        c = z[i].pop()
        z[i+1].append(c//2)
        count += 1 i range(t+1) range t+1 t 1 z[i] = sorted(z[i]) z[i] z i sorted(z[i]) sorted z[i] z i if count > m:
        break
     count > m count m break while z[i]:
        if count >= m:
            break
        c = z[i].pop()
        z[i+1].append(c//2)
        count += 1 z[i] z i if count >= m:
            break
         count >= m count m break c = z[i].pop() c z[i].pop() [i].pop [i] z i pop z[i+1].append(c//2) [i+1].append [i+1] z i+1 i 1 append c//2 c 2 count += 1 count 1 ans = 0 ans 0 for A in z:
    ans += sum(A) A z ans += sum(A) ans sum(A) sum A print(ans) print ans t = 0 0 t b = a[i] a[i] b a = sorted(a,reverse=True) sorted(a,reverse=True) a s = 0 0 s z = [[] for i in range(t+2)] [[] for i in range(t+2)] z b = -(-b//2) -(-b//2) b a = list(map(int,input().split())) list(map(int,input().split())) a M = -(-M//2) -(-M//2) M t += 1 1 t m = map(int,input().split()) map(int,input().split()) m count = 0 0 count M = max(a) max(a) M ans = 0 0 ans ans += sum(A) sum(A) ans n,m = map(int,input().split()) map(int,input().split()) n count += 1 1 count c = z[i].pop() z[i].pop() c s += 1 1 s
n,m = map(int,input().split())
a = list(map(int,input().split()))
M = max(a)
a = sorted(a,reverse=True)
t = 0
while M > 1:
    M = -(-M//2)
    t += 1
z = [[] for i in range(t+2)]
for i in range(n):
    s = 0
    b = a[i]
    while b > 1:
        b = -(-b//2)
        s += 1
    z[t-s].append(a[i])
count = 0
for i in range(t+1):
    z[i] = sorted(z[i])
    if count > m:
        break
    while z[i]:
        if count >= m:
            break
        c = z[i].pop()
        z[i+1].append(c//2)
        count += 1
ans = 0
for A in z:
    ans += sum(A)
print(ans)