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 =
    let (x, y) as b = Set.maxElement bt
    bt <- Set.remove b bt
    bt <- Set.add (x / 2L, y) bt
bt |> Set.fold (fun s (x, y) -> s + int64 x) 0L |> stdout.WriteLine