import Control.Monad
import Data.List
import Data.Maybe
import qualified Data.Set as S

deleteList [] re = re
deleteList (a:s) re = deleteList s (S.delete a re)

solve [] re = re
solve (ab:abs) re =solve abs (deleteList ab re)

main = do
    [n,m] <- map read . words <$> getLine :: IO [Int]
    abss <- replicateM m (map read . words <$> getLine) :: IO [[Int]]
    print $ S.size $ solve abss (S.fromList $ [1..n])

