{-# LANGUAGE PartialTypeSignatures #-}
module Main (main) where

import Control.Monad
import qualified Data.ByteString.Char8 as C8
import qualified Data.Char as C
import qualified Data.List as L
import qualified Data.Set as Set

main :: IO ()
main = do
  [n,k] <- readInts
  replicateM k (readInts >> readInts) >>= output . solve n . concat

solve :: Int -> [Int] -> _
-- solve n = Set.size . (xs Set.\\) . Set.fromList
solve n as = n - (Set.size . Set.fromList $ as)
  where
    xs = Set.fromList [1..n]

output :: _ -> IO ()
output = print

-- utils
readInts :: IO [Int]
readInts = L.unfoldr (C8.readInt . C8.dropWhile C.isSpace) <$> C8.getLine
