import Data.List

main :: IO ()
main = do
  [n,k] <- map (read :: String -> Int) . words <$> getLine
  an <- mySort . map (read :: String -> Int) . words <$> getLine
  print $ ans k an

ans :: Int -> [Int] -> Int
ans k an
  | l <= k = 0
  | otherwise = sum $ take (l-k) an
  where l = length an

mySort :: [Int] -> [Int]
mySort xs = sort . map snd $ foldl func [] xs where
  func [] k = [(k,1)]
  func ((a,b):acc) k = if a == k then (a,b+1):acc else (a,b):func acc k