import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n,m] <- getIntList
    as <- heapFromList <$> getIntList
    print $ solve m as
    
solve 0 as = sum $ heapToList as
solve m as = let (a,as') = deleteMax as in solve (m-1) (heapInsert as' (a `div` 2))

----heap
data Heap a = Empty | Heap Int a (Heap a) (Heap a) deriving Show

empty = Empty

singleton :: a -> Heap a
singleton x = Heap 1 x Empty Empty

--併合
merge :: Ord a => Heap a -> Heap a -> Heap a
merge h Empty = h
merge Empty h = h
merge h1@(Heap _ x l1 r1) h2@(Heap _ y l2 r2)
    | x > y     = makeHeap x l1 (merge r1 h2)
    | otherwise = makeHeap y l2 (merge r2 h1)

rank :: Heap a -> Int
rank Empty = 0
rank (Heap r _ _ _) = r

makeHeap :: a -> Heap a -> Heap a -> Heap a
makeHeap x a b
    | ra >= rb  = Heap (rb + 1) x a b
    | otherwise = Heap (ra + 1) x b a
    where ra = rank a
          rb = rank b

--挿入
heapInsert :: Ord a => Heap a -> a -> Heap a
heapInsert h x = merge (singleton x) h

--リストから
heapFromList :: Ord a => [a] -> Heap a
heapFromList = foldl heapInsert Empty

--リストへ
heapToList :: Ord a => Heap a -> [a]
heapToList h | isEmpty h = []
             | otherwise = let (x, h') = deleteMax h in x : heapToList h'

--最大値の取り出し（削除）
deleteMax :: Ord a => Heap a -> (a, Heap a)
deleteMax Empty = error "Empty Heap"
deleteMax (Heap _ x a b) = (x, merge a b)

--最大値を見る（削除しない）
findMax :: Heap a -> a
findMax Empty = error "Empty Heap"
findMax (Heap _ x _ _) = x

--空か
isEmpty :: Heap a -> Bool
isEmpty Empty = True
isEmpty _     = False