import Data.Bits
import Data.List
import Data.Maybe(fromJust)
import Control.Monad
import Data.Array as A ((!))
import Data.Graph
import qualified Data.Vector.Unboxed as V
--import qualified Data.Vector.Unboxed.Mutable as VM
import Control.Monad.ST
import Data.Maybe (fromMaybe)
import qualified Data.ByteString.Char8 as BS
--import Debug.Trace

toTuple :: [a] -> (a,a)
toTuple (x:y:_) = (x,y)
toTuple _ = undefined

getInt :: IO Int
getInt = fst . fromJust. BS.readInt <$> BS.getLine

getIntList :: IO [Int]
getIntList = unfoldr (BS.readInt . BS.dropWhile (== ' ')) <$> BS.getLine

getLineB :: (Read a) => IO [a]
getLineB = map (read.BS.unpack) . BS.words <$> BS.getLine

solve :: Int -> Graph -> Int
solve n graph = sub 1 1 [1]
  where
    sub s h ls | h > n  = 0
               | h == n = if sort ls == [1..n] then 1 else 0
               | otherwise = sum [sub nh (h+1) (nh:ls) | nh <- graph A.! s]

main :: IO ()
main = do
  [n,m] <- getIntList
  es <- replicateM m $ toTuple <$> getIntList
  print $ solve n (buildG (1,n) (es++(map (\(a,b) -> (b,a)) es)))
