open System

// prelude
let readStr () = stdin.ReadLine()

let reads f () = readStr().Split() |> Array.map f

let readInt () = stdin.ReadLine() |> int
let readInts () = stdin.ReadLine().Split() |> Array.map int

let pair = function
| [|a; b|] -> (a, b)
| _ -> failwith "owatta"

let triple = function
| [|a; b; c|] -> (a, b, c)
| _ -> failwith "owatta"

let inc n = n + 1
let dec n = n - 1

let inline flip f a b = f b a
let rec fix f = fun x -> (f (fix f)) x

module Option =
  let getOr defaultValue = function
  | Some x -> x
  | None -> defaultValue

module Array =
  let modify (arr: _ []) i f =
    arr.[i] <- f arr.[i]

module Array2D =
  let modify (arr: _ [,]) i j f =
    arr.[i, j] <- f arr.[i, j]

// Pairing Heap
type Heap<'a when 'a: comparison> = E | T of 'a * Heap<'a> list

[<RequireQualifiedAccess>]
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module Heap =
  let empty = E
  let isEmpty = function
    | E _ -> true
    | _ -> false
  let merge h1 h2 =
    match (h1, h2) with
    | (E _, _) -> h2
    | (_, E _) -> h1
    | (T(x1,hs1), T(x2,hs2)) ->
      if x1>x2 then T(x1, h2::hs1) else T(x2, h1::hs2)
  let insert x h = merge h (T(x, []))
  let rec private unify = function
    | [] -> E
    | [h] -> h
    | x::y::hs ->
      merge (merge x y) (unify hs)
  let head = function
    | E _ -> failwith "empty"
    | T(x,_) -> x
  let tail = function
    | E -> failwith "empty"
    | T(_,hs) -> unify hs
  let rec length = function
    | E -> 0
    | T(_, hs) -> 1+(hs |> List.sumBy length)
  let rec fold folder state = function
    | E -> state
    | T(x,hs) -> fold folder (folder state x) (unify hs)
  let (|Cons|Nil|) = function
    | E -> Nil
    | T(x,hs) -> Cons(x, unify hs)
// Pairing Heap
 
// start
let (N,M)=readInts()|>pair
let A=reads int64 ()

let rec go m = function
  | Heap.Nil -> failwith "arienai"
  | Heap.Cons (x,h) when m>0 -> go (m-1) (h|>Heap.insert (x/2L))
  | h -> h

A
|> Array.fold (flip Heap.insert) Heap.empty
|> go M
|> Heap.fold (+) 0L
|> printfn "%d"