import Data.List (sort, sortOn, group)

main :: IO ()
main = do
  [_,k] <- map read.words <$> getLine :: IO [Int]
  as <- sortOn (negate.length).group.sort.map read.words <$> getLine :: IO [[Int]]
  print $ sum $ drop k $ map length as
