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

readInt :: IO [Int]
readInt = map read . words <$> getLine

readIntlines :: Int -> IO [[Int]]
readIntlines n = map (map read . words) <$> replicateM n getLine

main :: IO ()
main = do
    [n, m] <- readInt
    ab <- readIntlines m
    print $ solve ab
    return ()

solve :: [[Int]] -> Int
solve xs = maximum $ map S.size $ f xs []
              where
                f [] newset     = newset
                f (y:ys) newset = f ys (set y newset)

set :: [Int] -> [S.Set Int] -> [S.Set Int]
set y gs = let (ts, fs) = partition (\c -> or $ map (`S.member` c) y) gs
            in if null ts
                  then (S.fromList y) : fs
                  else S.unions (S.fromList y : ts) : fs
