import Control.Monad
import Data.List

main = do
    [n, m] <- getPairs
    ab_s <- replicateM m getPairs
    mapM_ putStrLn $ map (show . length) $ group . sort $ mconcat ab_s

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