import Foundation
import CoreFoundation

#if swift(>=4.0)
prefix operator *
infix operator **: PowerPrecedence
precedencegroup PowerPrecedence {
    higherThan: MultiplicationPrecedence
    lowerThan: BitwiseShiftPrecedence
    associativity: right
}
#else
extension String {
    func split(separator separator: Character) -> [String] {
        return self.characters.split(separator).map{String($0)}
    }
    var count: Int {
        return self.characters.count
    }
    var first: Character? {
        return self.characters.first
    }
    var last: Character? {
        return self.characters.last
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
    func reversed() -> ReverseCollection<String.CharacterView> {
        return self.characters.reverse()
    }
    func forEach(body: (Character) -> Void) {
        return self.characters.forEach{body($0)}
    }
    func map<T>(transform: (Character) -> T) -> [T] {
        return self.characters.map{transform($0)}
    }
    func reduce<Result>(initialResult: Result, _ nextPartialResult: (Result, Character) -> Result) -> Result {
        return self.characters.reduce(initialResult){nextPartialResult($0, $1)}
    }
    func filter(isIncluded: (Character) -> Bool) -> String {
        return String(self.characters.filter{isIncluded($0)})
    }
    func enumerated() -> EnumerateSequence<String.CharacterView> {
        return self.characters.enumerate()
    }
}
extension Array where Element: Comparable {
    func max() -> Element? {
        return self.maxElement()
    }
    func min() -> Element? {
        return self.minElement()
    }
    func sorted(by areInIncreasingOrder: (Element, Element) -> Bool = {$0 < $1}) -> [Element] {
        return self.sort(areInIncreasingOrder)
    }
    mutating func sort(by areInIncreasingOrder: (Element, Element) -> Bool = {$0 < $1}) {
        self.sortInPlace(areInIncreasingOrder)
    }
}
extension Array {
    mutating func swapAt(i: Int, _ j: Int) {
        swap(&self[i], &self[j])
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func reverse() {
        self = self.reversed()
    }
    func enumerated() -> EnumerateSequence<[Element]> {
        return self.enumerate()
    }
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
extension _ArrayType where Generator.Element == String {
    func joined(separator separator: String = "") -> String {
        return self.joinWithSeparator(separator)
    }
}
extension Range {
    func reversed() -> [Element] {
        return self.reverse()
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
prefix operator * { }
infix operator ** {
    precedence 155      // 乗除算より強く，ビットシフトより弱い
    associativity right // 右結合
}
#endif
prefix func * <T> (a: [T]) -> (T, T)             { return (a[0], a[1]) }
prefix func * <T> (a: [T]) -> (T, T, T)          { return (a[0], a[1], a[2]) }
prefix func * <T> (a: [T]) -> (T, T, T, T)       { return (a[0], a[1], a[2], a[3]) }
prefix func * <T> (a: [T]) -> (T, T, T, T, T)    { return (a[0], a[1], a[2], a[3], a[4]) }
prefix func * <T> (a: [T]) -> (T, T, T, T, T, T) { return (a[0], a[1], a[2], a[3], a[4], a[5]) }
func **(lhs: Int, rhs: Int) -> Int {
    return Int(pow(Double(lhs), Double(rhs)))
}
func **(lhs: Int, rhs: Double) -> Double {
    return pow(Double(lhs), rhs)
}
func * <Element> (lhs: [Element], rhs: Int) -> [Element] {
    return (0..<rhs).flatMap{_ in lhs}
}
func *(lhs: String, rhs: Int) -> String {
    return (0..<rhs).reduce(""){s,_ in s+lhs}
}
let MOD = 10 ** 9 + 7
let alphabets = "abcdefghijklmnopqrstuvwxyz"
let ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
//protocol Container {
//    associatedtype Item
//    mutating func append(item: Item)
//    var count: Int { get }
//    subscript(i: Int) -> Item { get }
//}
struct Stack<Element>: 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) {
        items.append(item)
    }
    mutating func pop() -> Element {
        return items.removeLast()
    }
    mutating func append(item: Element) {
        self.push(item)
    }
    var count: Int {
        return items.count
    }
    subscript(i: Int) -> Element {
        return items[i]
    }
}
struct Queue<Element>: 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) {
        items.append(item)
    }
    mutating func pop() -> Element {
        return items.removeFirst()
    }
    mutating func append(item: Element) {
        self.push(item)
    }
    var count: Int {
        return items.count
    }
    subscript(i: Int) -> Element {
        return items[i]
    }
}
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
    }
    mutating func append(item: Element) {
        self.push(item)
    }
    var count: Int {
        return items.count
    }
    subscript(i: Int) -> Element {
        return items[i]
    }
}
extension Array where Element: Equatable {
    func count(of value: Element) -> Int {
        return self.reduce(0){$0+($1==value ? 1 : 0)}
    }
}
extension String {
    func count(of value: Character) -> Int {
        return self.reduce(0){$0+($1==value ? 1 : 0)}
    }
    subscript(i: Int) -> Character {
        return self.map{$0}[i]
    }
}
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringsSplit(by separator: Character = " ") -> [String] {
    return readLine()!.split(separator: separator).map{String($0)}
}
func readIntsSplit(by separator: Character = " ") -> [Int] {
    return readLine()!.split(separator: separator).map{Int($0)!}
}
func gcd(x: Int, _ y: Int) -> Int {
    return y>0 ? gcd(y, x%y) : x
}
func lcm(x: Int, _ y: Int) -> Int {
    return x * y / gcd(x, y)
}
func manhattanDistance(x1: Int, _ y1: Int, _ x2: Int, _ y2: Int) -> Int {
    return abs(x1 - x2) + abs(y1 - y2)
}
func euclideanDistance(x1: Int, _ y1: Int, _ x2: Int, _ y2: Int) -> Double {
    return sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
}

/*************** メインプログラム ***************/

let (N, M) = *readIntsSplit()
var a = Heap<Int>()
readIntsSplit().forEach{a.push(-$0)}
(0..<M).forEach{_ in a.push(a.pop()/2)}
print(a.reduce(0){$0-$1})


Measured memory_bytes: 8248