import Control.Monad
import Data.List

-- 06   100 90
ib k hs [] = hs ++ [k]
ib k hs (x:xs)
 | k >= x = hs++(k:x:xs)
 | otherwise  = ib k (hs++[x]) xs

inner 0 xs     = sum xs
inner m (x:xs) = inner (m-1) $ ib (div x 2) [] xs

main = do
 [n,m] <- map read . words <$> getLine :: IO [Int]
 a <- sortBy (\x y-> compare y x) . map read . words <$> getLine :: IO [Int]
 print $ inner m a
