import Data.List (sort)

main :: IO ()
main = interact $ format . solve . parse

parse :: String -> (Int, Int, [Int])
parse input = (n, k, h) where
    lns = lines input
    [n, k] = map read . words $ lns !! 0
    h = map read . words $ lns !! 1

solve :: (Int, Int, [Int]) -> Int
solve (n, k, h) = sum . take (n - k) . sort $ h

format :: Int -> String
format = (++ "\n") . show
