import Data.List.Split
import Data.List

main = do
        str <- getLine
        times <- getLine
        let nums = map (read) (splitOn " " str) :: [Int]
        let times' = read times :: Int
        let res = iterate multiToMax nums
        let ans = res !! times'
        putStrLn $ show (sum ans)

multiToMax list = (x * 2) : rest
        where
                sorted = sortBy (\x y -> compare y x) list
                x = head sorted
                rest = tail sorted