module Main where
import Control.Monad
import Control.Applicative
import Data.Maybe
import Data.List
import qualified Text.Printf
import qualified Data.ByteString.Char8 as BC
import qualified Data.ByteString as BC

------------------------------------------

main :: IO ()
main = do
  [n, m] <- readInts
  edges <- replicateM m $ do
    [a, b] <- readInts
    return (a-1, b-1)
  let graph = createGraph n edges
  print $ solve n graph

type Graph = [[Int]]

createGraph :: Int -> [(Int, Int)] -> Graph
createGraph n edges = loop (replicate n []) edges
  where updateGraph i v graph = concat [take i graph, [v : (graph !! i)], drop (i+1) graph]
        loop graph [] = graph
        loop graph ((a,b):es) =
          let nextGraph = updateGraph b a $ updateGraph a b graph
          in loop nextGraph es

solve :: Int -> Graph -> Int
solve n graph = dfs 0 1 [0]
  where dfs i depth visited
          | depth == n = 1
        dfs i depth visited
          | nexts == [] = 0
          | otherwise = sum $ flip map nexts $ \w -> dfs w (depth+1) (w:visited)
            where nexts = filter (not . (`elem` visited)) $ graph !! i

------------------------------------------

{- Int input -}

parseInt :: BC.ByteString -> Int
parseInt = fst . fromJust . BC.readInt

parseInts :: BC.ByteString -> [Int]
parseInts = map parseInt <$> BC.words

readInt :: IO Int
readInt = parseInt <$> BC.getLine

readInts :: IO [Int]
readInts = parseInts <$> BC.getLine

{- Double Formatting -}

doubleFmt :: Double -> String
doubleFmt = Text.Printf.printf "%.12f"
