{-# LANGUAGE ScopedTypeVariables #-}
import qualified Data.IntMap as IM
import Data.Ord
import Data.List

main = do
  [numMonsters, available] <- map read . words <$> getLine
  enemies :: [Int] <- map read . words <$> getLine
  let enemies' = sortBy (comparing negate) enemies
  print $ sum $ drop available enemies'