import Control.Monad
import Control.Applicative
import Data.List
import Data.Array
strToInt s = (read :: String -> Int) s

main = do

    [n,k] <- (map strToInt . words) <$> getLine
    an <- map strToInt . words <$> getLine
    
    let bn = reverse $ qsort (group (sort an))
    print (solve bn k 0)


solve :: [[Int]] -> Int -> Int -> Int
solve [] k m = m
solve bn k m = if (n <= k)
               then m
               else solve (init bn) k (m+x)
                    where n = length bn
                          x = length (last bn)

comp :: [Int] -> [Int] -> Bool
comp an bn = if (length an) < (length bn)
             then True
             else False

--qsort
qsort []     = []
qsort (p:xs) = qsort lt ++ [p] ++ qsort gteq
                 where
                   lt   = [x | x <- xs, (comp x p)]
                   gteq = [x | x <- xs, not (comp x p)]