def tickets(a, t):
  # a の最大値をt以下にするのに必要なチケットの枚数を答える
  ret = 0
  for x in a:
    while (x > t):
      x //= 2
      ret += 1
  return ret

def resolve():
  n, m = map(int, input().split())
  a = list(map(int, input().split()))

  lb = -1
  ub = 1000000000
  while (ub - lb > 1):
    mid = lb + (ub - lb) // 2
    t = tickets(a, mid)
    if t < m:
      ub = mid
    else:
      lb = mid

  t = 0
  for i in range(n):
    while (a[i] > ub):
      a[i] //= 2
      t += 1

  a.sort(reverse=True)

  for i in range(min(n, m-t)):
    a[i] //= 2

  print(sum(a))

  return

if __name__ == "__main__":
  resolve() def tickets(a, t):
  # a の最大値をt以下にするのに必要なチケットの枚数を答える
  ret = 0
  for x in a:
    while (x > t):
      x //= 2
      ret += 1
  return ret tickets ret = 0 ret 0 for x in a:
    while (x > t):
      x //= 2
      ret += 1
   x a while (x > t):
      x //= 2
      ret += 1
   x > t x t x //= 2 x 2 ret += 1 ret 1 return ret ret a a t t def resolve():
  n, m = map(int, input().split())
  a = list(map(int, input().split()))

  lb = -1
  ub = 1000000000
  while (ub - lb > 1):
    mid = lb + (ub - lb) // 2
    t = tickets(a, mid)
    if t < m:
      ub = mid
    else:
      lb = mid

  t = 0
  for i in range(n):
    while (a[i] > ub):
      a[i] //= 2
      t += 1

  a.sort(reverse=True)

  for i in range(min(n, m-t)):
    a[i] //= 2

  print(sum(a))

  return resolve 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 lb = -1 lb -1 ub = 1000000000 ub 1000000000 while (ub - lb > 1):
    mid = lb + (ub - lb) // 2
    t = tickets(a, mid)
    if t < m:
      ub = mid
    else:
      lb = mid

   ub - lb > 1 ub - lb ub lb 1 mid = lb + (ub - lb) // 2 mid lb + (ub - lb) // 2 lb (ub - lb) // 2 ub - lb ub lb 2 t = tickets(a, mid) t tickets(a, mid) tickets a mid if t < m:
      ub = mid
    else:
      lb = mid

   t < m t m ub = mid ub mid lb = mid lb mid t = 0 t 0 for i in range(n):
    while (a[i] > ub):
      a[i] //= 2
      t += 1

   i range(n) range n while (a[i] > ub):
      a[i] //= 2
      t += 1

   a[i] > ub a[i] a i ub a[i] //= 2 a[i] a i 2 t += 1 t 1 a.sort(reverse=True) a.sort a sort reverse=True reverse True for i in range(min(n, m-t)):
    a[i] //= 2

   i range(min(n, m-t)) range min(n, m-t) min n m-t m t a[i] //= 2 a[i] a i 2 print(sum(a)) print sum(a) sum a return if __name__ == "__main__":
  resolve() __name__ == "__main__" __name__ "__main__" resolve() resolve def tickets(a, t):
  # a の最大値をt以下にするのに必要なチケットの枚数を答える
  ret = 0
  for x in a:
    while (x > t):
      x //= 2
      ret += 1
  return ret def tickets(a, t):
  # a の最大値をt以下にするのに必要なチケットの枚数を答える
  ret = 0
  for x in a:
    while (x > t):
      x //= 2
      ret += 1
  return ret tickets def resolve():
  n, m = map(int, input().split())
  a = list(map(int, input().split()))

  lb = -1
  ub = 1000000000
  while (ub - lb > 1):
    mid = lb + (ub - lb) // 2
    t = tickets(a, mid)
    if t < m:
      ub = mid
    else:
      lb = mid

  t = 0
  for i in range(n):
    while (a[i] > ub):
      a[i] //= 2
      t += 1

  a.sort(reverse=True)

  for i in range(min(n, m-t)):
    a[i] //= 2

  print(sum(a))

  return def resolve():
  n, m = map(int, input().split())
  a = list(map(int, input().split()))

  lb = -1
  ub = 1000000000
  while (ub - lb > 1):
    mid = lb + (ub - lb) // 2
    t = tickets(a, mid)
    if t < m:
      ub = mid
    else:
      lb = mid

  t = 0
  for i in range(n):
    while (a[i] > ub):
      a[i] //= 2
      t += 1

  a.sort(reverse=True)

  for i in range(min(n, m-t)):
    a[i] //= 2

  print(sum(a))

  return resolve
def tickets(a, t):
  # a の最大値をt以下にするのに必要なチケットの枚数を答える
  ret = 0
  for x in a:
    while (x > t):
      x //= 2
      ret += 1
  return ret

def resolve():
  n, m = map(int, input().split())
  a = list(map(int, input().split()))

  lb = -1
  ub = 1000000000
  while (ub - lb > 1):
    mid = lb + (ub - lb) // 2
    t = tickets(a, mid)
    if t < m:
      ub = mid
    else:
      lb = mid

  t = 0
  for i in range(n):
    while (a[i] > ub):
      a[i] //= 2
      t += 1

  a.sort(reverse=True)

  for i in range(min(n, m-t)):
    a[i] //= 2

  print(sum(a))

  return

if __name__ == "__main__":
  resolve()
