struct Heap<Element: Comparable>: SequenceType, GeneratorType {
    var items = [Element]()
    var i = 0
    mutating func next() -> Element? {
        defer { i += 1 }
        return i < items.count ? items[i] : nil
    }
    mutating func push(item: Element) {
        var i = items.count
        while i > 0 {
            let p = (i - 1) / 2
            if items[p] <= item {
                break
            }
            if i == items.count {
                items.append(items[p])
            } else {
                items[i] = items[p]
            }
            i = p
        }
        if i == items.count {
            items.append(item)
        } else {
            items[i] = item
        }
    }
    mutating func pop() -> Element {
        let ret = items[0]
        let x = items[items.count - 1]
        var i: Int = 0
        while i * 2 + 1 < items.count - 1 {
            var a = i * 2 + 1
            let b = i * 2 + 2
            if b < items.count - 1 && items[b] < items[a] {
                a = b
            }
            if items[a] >= x {
                break
            }
            items[i] = items[a]
            i = a
        }
        items[i] = x
        _ = items.removeLast()
        return ret
    }
}
let M = Int(String(readLine()!.characters.split(" ")[1]))!
var a = Heap<Int>()
readLine()!.characters.split(" ").forEach{a.push(-Int(String($0))!)}
(0..<M).forEach{_ in a.push(a.pop()/2)}
print(a.reduce(0){$0-$1})