{-# LANGUAGE OverloadedStrings #-}
import Prelude hiding (null, elem)
import Control.Monad
import Data.Char
import Data.List hiding (insert, null, elem)
import Data.Maybe
import qualified Data.ByteString.Char8 as BS

main :: IO ()
main = do
  [n, m] <- getIntList
  queue <- fromList <$> getIntList
  print $ solve m queue

solve :: Int -> Heap Int -> Int
solve m queue
  | m == 0 = sum . toList $ queue
  | otherwise = solve (m - 1) . uncurry insert . mapFst (`div`2) . deleteFindMax $ queue

mapFst :: (a -> b) -> (a, c) -> (b, c)
mapFst f (a, b) = (f a, b)

-- Leftist Heap
data Heap a =
  Empty |
  Heap {
    rank :: Int,
    elem :: a,
    left :: Heap a,
    right ::Heap a}

empty :: Heap a
empty = Empty

null :: Heap a -> Bool
null Empty = True
null (Heap _ _ _ _) = False 

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 h2
  | elem h1 > elem h2 = makeHeap (elem h1) (left h1) (merge (right h1) h2)
  | otherwise = makeHeap (elem h2) (left h2) (merge (right h2) h1)

makeHeap :: a -> Heap a -> Heap a -> Heap a
makeHeap x a b =
  if ra >= rb then Heap (rb + 1) x a b else Heap (ra + 1) x b a
  where 
    rb = if null b then 0 else rank b
    ra = if null a then 0 else rank a

insert :: Ord a => a -> Heap a -> Heap a
insert x h = merge (singleton x) h

deleteFindMax :: Ord a => Heap a -> (a, Heap a)
deleteFindMax Empty = error "Empty Heap"
deleteFindMax (Heap _ x a b) = (x, merge a b)

fromList :: Ord a => [a] -> Heap a
fromList = foldl (flip insert) Empty

toList :: Ord a => Heap a -> [a]
toList h
  | null h = []
  | otherwise = let (x, h') = deleteFindMax h
                in x : toList h'
-- IO
readInt :: BS.ByteString -> Int
readInt = fst . fromJust . BS.readInt

getInt :: IO Int
getInt = readInt <$> BS.getLine

getIntList :: IO [Int]
getIntList = unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine