import Control.Applicative
import Data.List

main :: IO ()
main = do
    [a, b] <- map read . words <$> getLine
    ns <- map read . words <$> getLine
    putStrLn $ show (solve b (reverse (sort ns)))
   
solve :: Int -> [Int] -> Int
solve b ns = sum (drop b ns)