import Data.List
import Control.Monad

main = do
  [n, m] <- map read . words <$> getLine
  ab <- map (map read . words) <$> replicateM m getLine
  putStrLn $ solve n m ab 

solve:: Int -> Int -> [[Int]] -> String
solve n m ab = foldl (\x -> \y -> x ++ y ++ "\n") "" $ map (show . length) $ group $ sort $ concat ab
