// Learn more about F# at http://fsharp.org
open System
open System.Collections.Generic

let swap (arr : 'a []) a b =
    let newArr = Array.copy arr
    let tmp = newArr.[a]
    newArr.[a] <- newArr.[b]
    newArr.[b] <- tmp
    newArr

let bigSum (arr : int []) =
    let rec loop (i : int) (sum : int64) =
        if i < 0 then sum
        else sum + int64 arr.[i] |> loop (i - 1)
    loop (arr.Length - 1) (int64 0)

let factorial (num : int) =
    let rec loop acc num =
        match num with
        | 1 -> acc
        | _ -> num - 1 |> loop (acc * num)
    loop 1 num

let binarySearch (arr : 'a []) (key : 'a) =
    let rec loop (arr : 'a []) (key : 'a) (minIndex : int) (maxIndex : int) =
        if maxIndex < minIndex then -1
        else
            let midIndex = minIndex + (maxIndex - minIndex) / 2
            if arr.[midIndex] > key then loop arr key minIndex (midIndex - 1)
            elif arr.[midIndex] < key then loop arr key (midIndex + 1) maxIndex
            else midIndex
    loop arr key 0 arr.Length

type Heap() =
    let mutable data : List<int> = new List<int>()
    member this.Data = data

    member this.Push(el : int) =
        data.Add(el)
        let rec loop (data : List<int>) (nowIndex : int) =
            if nowIndex = 0 then data
            else
                let isLeft = nowIndex % 2 = 1

                let maxChild =
                    match isLeft with
                    | true -> data.[nowIndex]
                    | false -> max data.[nowIndex] data.[nowIndex - 1]

                let parentIndex =
                    match isLeft with
                    | true -> nowIndex / 2
                    | false -> (nowIndex - 1) / 2

                if maxChild > data.[parentIndex] then
                    let swap = data.[nowIndex]
                    data.[nowIndex] <- data.[parentIndex]
                    data.[parentIndex] <- swap
                    loop data parentIndex
                else data
        data <- loop data (data.Count - 1)

    member this.Pop() =
        let popped = data.[0]
        let lastIndex = data.Count - 1
        if lastIndex > 0 then
            let swap = data.[0]
            data.[0] <- data.[lastIndex]
            data.[lastIndex] <- swap
            data.RemoveAt(lastIndex)
        let newLastIndex = lastIndex - 1

        let rec loop (data : List<int>) (nowIndex : int) =
            if newLastIndex < 0 then data
            else
                let leftChildIndex =
                    let index =
                        if nowIndex = 0 then 1
                        else nowIndex * 2 + 1
                    if index <= newLastIndex then index
                    else -1

                let rightChildIndex =
                    let index =
                        if nowIndex = 0 then 2
                        else nowIndex * 2 + 2
                    if index <= newLastIndex then index
                    else -1

                let maxChildIndex =
                    if (if leftChildIndex = -1 then 0
                        else data.[leftChildIndex]) > (if rightChildIndex = -1 then
                                                           0
                                                       else
                                                           data.[rightChildIndex])
                    then leftChildIndex
                    else rightChildIndex
                    |> fun index ->
                        match index with
                        | -1 -> nowIndex
                        | _ -> index

                if data.[nowIndex] < data.[maxChildIndex] then
                    let swap = data.[nowIndex]
                    data.[nowIndex] <- data.[maxChildIndex]
                    data.[maxChildIndex] <- swap
                    loop data maxChildIndex
                else data
        data <- loop data 0
        popped

// maybe there is a better way to simplify this
let private (|Greater|_|) descendent compareResult =
    match compareResult with
    | n when n < 0 && descendent  -> None
    | n when n < 0 && not descendent  -> Some()
    | 0 -> None
    | n when n > 0 && descendent -> Some()
    | n when n > 0 && not descendent -> None
    | _ -> failwith "Impossible case for IComparable result"

let private isGreater x y descendent =
    match compare x y with
    | Greater descendent _ -> true
    | _ -> false

let private isLower x y descendent = not (isGreater x y descendent)

type PriorityQueue<'T when 'T : comparison>(values: seq<'T>, isDescending: bool) =
    let heap : System.Collections.Generic.List<'T> = System.Collections.Generic.List<'T>(values)
    
    let mutable size = heap.Count

    let parent i = (i - 1) / 2
    let leftChild i = 2 * i + 1
    let rightChild i = 2 * i + 2

    let swap i maxIndex =
        let temp = heap.[i]
        heap.[i] <- heap.[maxIndex]
        heap.[maxIndex] <- temp

    let siftUp i =
        let mutable indx = i
        while indx > 0 && isLower heap.[parent indx] heap.[indx] isDescending do
            swap (parent indx) indx
            indx <- parent indx

    let rec siftDown i =
        let l = leftChild i
        let r = rightChild i
        // maybe there is a cleaner way to express those
        let maxIndexLeft = if l < size && isGreater heap.[l] heap.[i] isDescending then l else i
        let maxIndex = if r < size && isGreater heap.[r] heap.[maxIndexLeft] isDescending then r else maxIndexLeft
        if i <> maxIndex then
            swap i maxIndex
            siftUp maxIndex
        else ()
    
    let build (unsortedValues: seq<'T>) =
        for i = size / 2 downto 0 do
            siftDown i
    
    do build heap

    new (values) = PriorityQueue<'T>(values, true)
    
    member this.Heap = heap

    member this.IsEmpty = size = 0

    member this.Dequeue() =
        if this.IsEmpty then raise (new Exception("No more elements to dequeue"))
        let result = heap.[0]
        heap.[0] <- heap.[size - 1]
        // we limit the boundary but the last element stays in memory
        // we could use heap.Remove but it's O(n) operation so too slow
        size <- size - 1
        siftDown 0
        result

    member this.Enqueue(p: 'T) =
        if heap.Count = size then
            heap.Add(p)
        else
            heap.[size] <- p
        size <- size + 1
        siftUp (size - 1)

// usage (call Dequeue(), Enqueue ...)

let pMax = new PriorityQueue<int>([|3; 1; 4; 2|])
let pMin = new PriorityQueue<int>([|3; 1; 4; 2|], false)

[<CustomComparison; StructuralEquality>]
type Point = { X: int; 
               Y: int }
                interface IComparable<Point> with
                    member this.CompareTo other =
                        compare this.Y other.Y
                interface IComparable with
                    member this.CompareTo(obj: obj) =
                        match obj with
                        | :? Point -> compare this.Y (unbox<Point> obj).Y
                        | _ -> invalidArg "obj" "Must be of type Point"

[<EntryPoint>]
let main _argv =
    let [| _; m |] = stdin.ReadLine().Split(' ') |> Array.map int
    let aList = stdin.ReadLine().Split(' ') |> Array.map int
//    let heap = new Heap()
//    for a in aList do
//        heap.Push(int a)
//    for _ in 1..m do
//        let a = heap.Pop()
//        let newA = a / 2
//        heap.Push(newA)
//    bigSum (heap.Data.ToArray()) |> printfn "%d"
    
    let queue = new PriorityQueue<int>([||])
    for a in aList do
        queue.Enqueue(a)
    for _ in 1..m do
        let a = queue.Dequeue()
        let newA = a / 2
        queue.Enqueue(newA)
    bigSum (queue.Heap.ToArray()) |> printfn "%d"
    0 // return an int exit code
