{-# LANGUAGE BangPatterns #-}

import Control.Monad
import Control.Monad.Trans.State.Strict
import Data.Char (isSpace)
import Data.Maybe (fromJust)
import qualified Data.ByteString.Lazy.Char8 as B
--
import qualified Data.List as L
import qualified Data.Set as S

type Parser a = StateT B.ByteString Maybe a

parseInt :: Parser Int
parseInt = StateT (B.readInt . B.dropWhile isSpace)

parseInt2 :: Parser (Int,Int)
parseInt2 = liftM2 (,) parseInt parseInt

parse :: Parser (Int, [(Int,Int)])
parse = do
    n<-parseInt
    m<-parseInt
    liftM ((,) n) $ replicateM m parseInt2

main=do
    (n,as) <- fromJust.evalStateT parse <$> B.getContents
    print.length.filter (chk (S.fromList as)).map (1:) $ perm [2..n]

perm [] = [[]]
perm xs = concat [map (x:) $ perm (filter (/=x) xs)|x<-xs]

chk _ [_] = True
chk s (a:b:r) = and[ or[S.member (a,b) s, S.member (b,a) s], chk s (b:r)]