import Data.List
main=do
 [n,k]<-map read.words<$>getLine
 a<-sort.words<$>getLine
 print(n-(sum(take k((reverse.sort)(f a n 1)))))
  where f a n i |n==1       =[i]
                |a!!0/=a!!1 =i:(f(tail a)(n-1)1)
                |otherwise  =f(tail a)(n-1)(i+1)