{-# LANGUAGE ViewPatterns #-}

import Control.Applicative
import Control.Monad
import Data.List
import Data.Array.IArray
import Data.Graph (buildG)
import qualified Data.Sequence as S

bfs :: Int -> Array Int [Int] -> [[Int]]
bfs n g = walk queue
  where
    queue = S.fromList [[1]]
    walk (S.viewl -> S.EmptyL) = []
    walk (S.viewl -> xs S.:< s')
        | length xs == n = xs : walk s'
        | otherwise      = walk $ s' S.>< s''
      where
        as  = filter (`notElem` xs) (g ! head xs)
        s'' = S.fromList $ zipWith (:) as (repeat xs)

main :: IO ()
main = do
    [n, m] <- fmap read . words <$> getLine
    as <- fmap concat . replicateM m $ do
        [a, b] <- fmap read . words <$> getLine
        return [(a, b), (b, a)]
    let g = buildG (1, n) as
    print $ length $ bfs n g