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
        | S.null s = []
        | (xs S.:< s') <- S.viewl s
            = if length xs == n
                then xs : walk s'
                else walk (s' S.>< S.fromList (f xs))
      where
        f ys = zipWith (:) (filter (`notElem` ys) $ g ! head ys) (repeat ys)

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