import math

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


def is_ok(x):
    cnt = 0
    for a in A:
        while math.floor(a) > x:
            cnt += 1
            a /= 2
        # cnt += math.ceil(math.log(a / x))
    return cnt <= M

def bisect(ng, ok):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok

X = bisect(-1, max(A))
ans = 0
cnt = 0
for a in A:
    while math.floor(a) > X:
        cnt += 1
        a /= 2
    ans += math.floor(a)
ans -= math.ceil(X / 2) * (M - cnt)
print(ans) import math math 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 def is_ok(x):
    cnt = 0
    for a in A:
        while math.floor(a) > x:
            cnt += 1
            a /= 2
        # cnt += math.ceil(math.log(a / x))
    return cnt <= M is_ok cnt = 0 cnt 0 for a in A:
        while math.floor(a) > x:
            cnt += 1
            a /= 2
        # cnt += math.ceil(math.log(a / x))
     a A while math.floor(a) > x:
            cnt += 1
            a /= 2
        # cnt += math.ceil(math.log(a / x))
     math.floor(a) > x math.floor(a) math.floor math floor a x cnt += 1 cnt 1 a /= 2 a 2 return cnt <= M cnt <= M cnt M x x def bisect(ng, ok):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok bisect while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
     abs(ok - ng) > 1 abs(ok - ng) abs ok - ng ok ng 1 mid = (ok + ng) // 2 mid (ok + ng) // 2 ok + ng ok ng 2 if is_ok(mid):
            ok = mid
        else:
            ng = mid
     is_ok(mid) is_ok mid ok = mid ok mid ng = mid ng mid return ok ok ng ng ok ok X = bisect(-1, max(A)) X bisect(-1, max(A)) bisect -1 max(A) max A ans = 0 ans 0 cnt = 0 cnt 0 for a in A:
    while math.floor(a) > X:
        cnt += 1
        a /= 2
    ans += math.floor(a) a A while math.floor(a) > X:
        cnt += 1
        a /= 2
     math.floor(a) > X math.floor(a) math.floor math floor a X cnt += 1 cnt 1 a /= 2 a 2 ans += math.floor(a) ans math.floor(a) math.floor math floor a ans -= math.ceil(X / 2) * (M - cnt) ans math.ceil(X / 2) * (M - cnt) math.ceil(X / 2) math.ceil math ceil X / 2 X 2 M - cnt M cnt print(ans) print ans X = bisect(-1, max(A)) bisect(-1, max(A)) X N, M= map(int, input().split()) map(int, input().split()) N ans -= math.ceil(X / 2) * (M - cnt) math.ceil(X / 2) * (M - cnt) ans def bisect(ng, ok):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok def bisect(ng, ok):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok bisect ans += math.floor(a) math.floor(a) ans a /= 2 2 a def is_ok(x):
    cnt = 0
    for a in A:
        while math.floor(a) > x:
            cnt += 1
            a /= 2
        # cnt += math.ceil(math.log(a / x))
    return cnt <= M def is_ok(x):
    cnt = 0
    for a in A:
        while math.floor(a) > x:
            cnt += 1
            a /= 2
        # cnt += math.ceil(math.log(a / x))
    return cnt <= M is_ok A = list(map(int, input().split())) list(map(int, input().split())) A ans = 0 0 ans cnt = 0 0 cnt M= map(int, input().split()) map(int, input().split()) M cnt += 1 1 cnt
import math

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


def is_ok(x):
    cnt = 0
    for a in A:
        while math.floor(a) > x:
            cnt += 1
            a /= 2
        # cnt += math.ceil(math.log(a / x))
    return cnt <= M

def bisect(ng, ok):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok

X = bisect(-1, max(A))
ans = 0
cnt = 0
for a in A:
    while math.floor(a) > X:
        cnt += 1
        a /= 2
    ans += math.floor(a)
ans -= math.ceil(X / 2) * (M - cnt)
print(ans)
