Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a_l = list(map(int, input().split()))
a_l.sort(reverse=True)

m_count = 0

while True:
    a_l[0] //= 2
    m_count += 1
    max_price = a_l[0]
    for j in range(1,n):
        if a_l[j] >= max_price:
            a_l[j] //2
            m_count += 1
            if m_count == m:
                break
        else:
            break
    a_l.sort(reverse=True)

ans = 0
for i in range(n):
    ans += a_l[i]
print(ans)

Fixed submission:
n, m = map(int, input().split())
a_l = list(map(int, input().split()))
a_l.sort(reverse=True)

m_count = 0
while True:
    max_price = a_l[0]//2
    for j in range(n):
        if a_l[j] >= max_price:
            a_l[j] //= 2
            m_count += 1
            if m_count == m:
                break
        else:
            break
        if m_count == m:
            break
    a_l.sort(reverse=True)
    if m_count == m:
        break

ans = 0
for i in range(n):
    ans += a_l[i]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a_l = list(map(int, input().split()))
a_l.sort(reverse=True)

for i in range(m):
    a_l[0] //= 2
    max_price = a_l[0]
    for j in range(1,n):
        if a_l[j] >= max_price:
            a_l[j] //2
        else:
            break
    a_l.sort(reverse=True)

ans = 0
for i in range(n):
    ans += a_l[i]
print(ans)

Fixed submission:
n, m = map(int, input().split())
a_l = list(map(int, input().split()))
a_l.sort(reverse=True)

m_count = 0
while True:
    max_price = a_l[0]//2
    for j in range(n):
        if a_l[j] >= max_price:
            a_l[j] //= 2
            m_count += 1
            if m_count == m:
                break
        else:
            break
        if m_count == m:
            break
    a_l.sort(reverse=True)
    if m_count == m:
        break

ans = 0
for i in range(n):
    ans += a_l[i]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a_l = list(map(int, input().split()))
a_l.sort(reverse=True)

total = 0
for i in range(n):
    total += a_l[i]

for i in range(m):    
    total -= (a_l[0]+1)//2
    a_l[0] //= 2
    for j in range(n-1):
        if a_l[j] >= a_l[j+1]:
            break
        else:
            a_l[j], a_l[j+1] = a_l[j+1], a_l[j]

print(total)

Fixed submission:
n, m = map(int, input().split())
a_l = list(map(int, input().split()))
a_l.sort(reverse=True)

m_count = 0
while True:
    max_price = a_l[0]//2
    for j in range(n):
        if a_l[j] >= max_price:
            a_l[j] //= 2
            m_count += 1
            if m_count == m:
                break
        else:
            break
        if m_count == m:
            break
    a_l.sort(reverse=True)
    if m_count == m:
        break

ans = 0
for i in range(n):
    ans += a_l[i]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a_l = list(map(int, input().split()))

sum = 0
for i in range(n):
    sum += a_l[i]

for i in range(m):
    a_l.sort(reverse=True)
    sum -= (a_l[0]+1)//2
    a_l[0] //= 2

print(sum)

Fixed submission:
n, m = map(int, input().split())
a_l = list(map(int, input().split()))
a_l.sort(reverse=True)

m_count = 0
while True:
    max_price = a_l[0]//2
    for j in range(n):
        if a_l[j] >= max_price:
            a_l[j] //= 2
            m_count += 1
            if m_count == m:
                break
        else:
            break
        if m_count == m:
            break
    a_l.sort(reverse=True)
    if m_count == m:
        break

ans = 0
for i in range(n):
    ans += a_l[i]
print(ans)