import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}
import scala.collection.mutable.{Map, Queue, PriorityQueue}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val N, M = in.next().toInt
  val A = new Array[Long](N+1)
  for (i <- 1 to N)
    A(i) = in.next().toLong

  ///
  def check(n: Long): Boolean = {
    var rest = M
    var flag = true
    breakable {
      for (i <- 1 to N) {
        var div = 1L
        while (A(i) >= (n+1) * div) {
          rest -= 1
          div *= 2L
        }

        if (rest < 0){
          flag = false
          break
        }
      }
    }

    flag
  }

  // 条件を満たす最小の値を返す
  def binarySearch(min: Long, max: Long): Long = {
    val mid: Long = (max + min) / 2
      (max - min) match{
      case 0 | 1 =>
        check(min) match{
          case true  => min
          case false => max
        }
      case _ =>
        (check(mid)) match{
          case true  => binarySearch(min, mid)
          case false => binarySearch(mid, max)
        }
    }
  }


  /** */
  val base = binarySearch(0L, 1e9.toLong)

  var ans = 0L
  var rest = M
  for (i <- 1 to N) {
    var div = 1L
    while (A(i) >= (base+1) * div) {
      rest -= 1
      div *= 2L
    }

    A(i) = A(i) / div
  }

  val B = A.sorted

  breakable {
    for (i <- (1 to N).reverse) {
      if (rest == 0)
        break
      else {
        rest -= 1
        B(i) = B(i) / 2
      }
    }
  }
  ans = B.sum
  println(ans)

}


class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}
