import qualified Data.Vector.Unboxed as V
import qualified Data.Map as MP
import Data.Tuple
import Data.Maybe
import Data.List

type Graph = MP.Map Int (V.Vector Int)

toTuple :: [Int] -> (Int, Int)
toTuple [a, b] = (a, b)

make :: Int -> Int -> V.Vector (Int, Int) -> Graph
make n m es = graph
    where
        init = V.foldl' (\g from -> MP.insert from (V.empty) g) MP.empty (V.fromList [1..n])
        graph = V.foldl' (\g (from, to) -> MP.adjust (V.cons to) from g) init (es V.++ V.map swap es)

solve :: Graph -> [Int] -> Int -> Int -> Int
solve graph arrived curr prev
   | curr `notElem` arrived = 0
   | null d = 1
   | otherwise = V.sum $ V.map (\n -> solve graph d n curr) ns
    where
       ns = V.filter (/=curr) $ fromJust $ MP.lookup curr graph
       d = delete curr arrived
        

main = do
    [n, m] <- map read . words <$> getLine :: IO [Int]
    es <- V.replicateM m (toTuple . map read . words <$> getLine)
    let graph = make n m es
    print $ solve graph [1..n] 1 (-1)