import qualified Data.ByteString.Char8 as BS
import qualified Data.List as L
import qualified Data.Set as S
import qualified Control.Monad as M
import Data.Maybe (fromJust)

main = do
 [n,k] <- map read <$> words <$> getLine
 a <- S.size <$>S.unions<$> M.replicateM k gen
 print (n-a)

gen = do
 getLine
 S.fromList<$>BS.words<$>BS.getLine
