struct Heap<Element: Comparable>: CollectionType {
  var items = [Element]()
  var startIndex: Int {
    return items.startIndex
  }
  var endIndex: Int {
    return items.endIndex
  }
  subscript(i: Int) -> Element {
    return items[i]
  }
  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 q=Heap<Int>()
readLine()!.characters.split(" ").map{q.push(-Int(String($0))!)}
(0..<M).map{_ in q.push(q.pop()/2)}
print(q.reduce(0){$0-$1})