import Data.List
import Control.Monad

main = do
  [n,m] <- map read . words <$> getLine :: IO [Int]
  input <- replicateM m $ (map read . words) <$> getLine :: IO [[Int]]
  -- input <- map read . words <$> getContents :: IO [Int]
  let connect = concat input
  mapM_ print (map (pred . length) $ group $ sort $ [1..n] ++ connect)