[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reada f = stdin.ReadLine().Split() |> Array.map f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

[<EntryPoint>]
let main _ =
    let [n;m] = reads int
    let xs = reads int

    let mutable ss = Set.ofList (List.zip xs [1..n])
    for i = 1 to m do
        let (x, y) as a = Set.maxElement ss
        ss <- Set.remove a ss
        ss <- Set.add (x / 2, y) ss

    Set.fold (fun s (x, y) -> s + int64 x) 0L ss
    |> printfn "%i"

    0