import Data.List

input k = loop [] k
  where
    loop :: [Int] -> Int -> IO [Int]
    loop list k = do
      if k == 0
        then return list
        else do
        _ <- getLine
        sunuke <- map read . words <$> getLine
        loop (nub (sunuke ++ list)) (k-1)


main = do
  [n,k] <- map read . words <$> getLine
  ns <- length <$> input k
  print $ n - ns
