import Control.Monad
import Data.List

throwAwayKAndGetList :: IO [Int]
throwAwayKAndGetList = do
 _  <- getLine -- throw away K
 ak <- map read <$> words <$> getLine :: IO [Int]
 return ak

main = do
 [n,k] <- map read <$> words <$> getLine :: IO[Int]
 aijList <- concat <$> replicateM k throwAwayKAndGetList
 let a = nub $ sort aijList
 print $ (-) n (length a)