Buggy python submission (verdict: Time Limit Exceeded):
n, m, *a = map(int, open(0).read().split())

a.sort(reverse=True)

a0 = 0
a1 = 0

if n == 1:
  for i in range (0,m):
    a[0] = a[0]//2
    if a[0] == 0:
      break
else:
  for i in range (0,m):
    a[0] = a[0]//2
    if a[0] < a[1]:
      if a[0] < a[2]:
        a.sort(reverse=True)
      else:
        a0 = a[0]
        a1 = a[1]
        a[0] = a1
        a[1] = a0

print(sum(a))

Fixed submission:
n, m, *a = map(int, open(0).read().split())

a.sort(reverse=True)

if n == 1:
  for i in range (0,m):
    a[0] = a[0]//2
    if a[0] == 0:
      break
else:
  a.append(0)
  biggest = a[0]
  now = 0
  while m > 0:
    a[now] = a[now]//2
    m = m - 1
    biggest = a[0]
    for i in range (n-1):
      if a [i+1] >= biggest and m>0:
        a[i+1] = a[i+1]//2
        m = m -1
      else:
        a.sort(reverse = True)
        break

print(sum(a))

Buggy python submission (verdict: Time Limit Exceeded):
n, m, *a = map(int, open(0).read().split())

a = sorted(a, reverse=True)

if n == 1:
  for i in range (0,m):
    a[0] = a[0]//2
    if a[0] == 0:
      break
else:
  for i in range (0,m):
    a[0] = a[0]//2
    if a[0] < a[1]:
      a = sorted(a, reverse=True)

print(sum(a))

Fixed submission:
n, m, *a = map(int, open(0).read().split())

a.sort(reverse=True)

if n == 1:
  for i in range (0,m):
    a[0] = a[0]//2
    if a[0] == 0:
      break
else:
  a.append(0)
  biggest = a[0]
  now = 0
  while m > 0:
    a[now] = a[now]//2
    m = m - 1
    biggest = a[0]
    for i in range (n-1):
      if a [i+1] >= biggest and m>0:
        a[i+1] = a[i+1]//2
        m = m -1
      else:
        a.sort(reverse = True)
        break

print(sum(a))

Buggy python submission (verdict: Runtime Error):
n, m, *a = map(int, open(0).read().split())

a = sorted(a, reverse=True)

for i in range (0,m):
  a[0] = a[0]//2
  if a[0] < a[1]:
    a = sorted(a, reverse=True)
    if a[0] == 0:
      break

print(sum(a))

Fixed submission:
n, m, *a = map(int, open(0).read().split())

a.sort(reverse=True)

if n == 1:
  for i in range (0,m):
    a[0] = a[0]//2
    if a[0] == 0:
      break
else:
  a.append(0)
  biggest = a[0]
  now = 0
  while m > 0:
    a[now] = a[now]//2
    m = m - 1
    biggest = a[0]
    for i in range (n-1):
      if a [i+1] >= biggest and m>0:
        a[i+1] = a[i+1]//2
        m = m -1
      else:
        a.sort(reverse = True)
        break

print(sum(a))

Buggy python submission (verdict: Time Limit Exceeded):
n, m, *a = map(int, open(0).read().split())
a = sorted(a, reverse=True)

for i in range (0,m):
  a[0] = a[0]//2
  a = sorted(a, reverse=True)
  if a[0] == 0:
    break

print(sum(a))

Fixed submission:
n, m, *a = map(int, open(0).read().split())

a.sort(reverse=True)

if n == 1:
  for i in range (0,m):
    a[0] = a[0]//2
    if a[0] == 0:
      break
else:
  a.append(0)
  biggest = a[0]
  now = 0
  while m > 0:
    a[now] = a[now]//2
    m = m - 1
    biggest = a[0]
    for i in range (n-1):
      if a [i+1] >= biggest and m>0:
        a[i+1] = a[i+1]//2
        m = m -1
      else:
        a.sort(reverse = True)
        break

print(sum(a))

Buggy python submission (verdict: Time Limit Exceeded):
n, m, *a = map(int, open(0).read().split())
a = sorted(a, reverse=True)

for i in range (0,m):
  a[0] = a[0]//2
  a = sorted(a, reverse=True)

print(sum(a))

Fixed submission:
n, m, *a = map(int, open(0).read().split())

a.sort(reverse=True)

if n == 1:
  for i in range (0,m):
    a[0] = a[0]//2
    if a[0] == 0:
      break
else:
  a.append(0)
  biggest = a[0]
  now = 0
  while m > 0:
    a[now] = a[now]//2
    m = m - 1
    biggest = a[0]
    for i in range (n-1):
      if a [i+1] >= biggest and m>0:
        a[i+1] = a[i+1]//2
        m = m -1
      else:
        a.sort(reverse = True)
        break

print(sum(a))