fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(" ").map { it.toInt() }
    val a = readLine()!!.split(" ").map { it.toLong() }.toMutableList()
    val useMyclass = namayatsuHeap(a)
    for (i in 0 until m) {
        var max = useMyclass.mySortedList[0] / 2
        useMyclass.removeMax()
        useMyclass.addNum(max)
    }
    var total:Long = 0
    for (i in 0 until n){
        total += useMyclass.mySortedList[i]
    }
    println(total)
}



private class namayatsuHeap(mylist: MutableList<Long>) {
    val mySortedList = mylist.sortedDescending().toMutableList()
    val listSize = mySortedList.count()

    fun addNum(addedNumber: Long) {
        mySortedList += addedNumber
        val listSizuInthis = mySortedList.count()
        var uppingIndexNum = listSizuInthis - 1
        for (i in 0 until listSize) {

            val parentIndexNum = (uppingIndexNum - 1 ) / 2
            if (addedNumber > mySortedList[parentIndexNum]) {
                var tmp = mySortedList[parentIndexNum]
                mySortedList[parentIndexNum] = mySortedList[uppingIndexNum]
                mySortedList[uppingIndexNum] = tmp
                uppingIndexNum = parentIndexNum
            } else {
                break
            }
        }
    }

    fun removeMax() {
        mySortedList[0] = mySortedList[listSize - 1]
        mySortedList.removeAt(listSize - 1)
        var dawningIndexNum = 0
        for(i in 0 until listSize){
            var childIndexNumFir = 2 * dawningIndexNum + 1
            var childIndexNumSec = 2 * dawningIndexNum + 2
            var childIndexNum = 0
            if (childIndexNumFir > listSize-2){
                break
            } else if (childIndexNumFir == listSize - 2){
                childIndexNum = childIndexNumFir
            } else if (mySortedList[childIndexNumFir] >= mySortedList[childIndexNumSec]){
                childIndexNum = childIndexNumFir
            } else {
                childIndexNum = childIndexNumSec
            }
            if (mySortedList[dawningIndexNum] < mySortedList[childIndexNum]){
                var Tmp = mySortedList[childIndexNum]
                mySortedList[childIndexNum] = mySortedList[dawningIndexNum]
                mySortedList[dawningIndexNum] = Tmp
                dawningIndexNum = childIndexNum
            } else {
                break
            }
        }
    }
}