let [|n;m|] = stdin.ReadLine().Split() |> Array.map int
let mutable a = stdin.ReadLine().Split() |> Array.map int64
let mutable bt = Array.zip a [|1..n|] |> Set.ofArray
let rec f i =
    if i=m then ()
    else
        let (x, y) as b = Set.maxElement bt
        bt <- Set.remove b bt
        bt <- Set.add (x / 2L, y) bt
        f (i+1)
f 0
bt |> Set.fold (fun s (x, y) -> s + int64 x) 0L |> stdout.WriteLine