import Control.Applicative
import Control.Monad
import Data.List
import Data.Set (Set)
import qualified Data.Set as S

main :: IO ()
main = do
  [n, m] <- f
  solve n <$> replicateM m f >>= print
  where
    f = map read <$> words <$> getLine

solve :: Int -> [[Int]] -> Int
solve n abs = foldl' f 0 (permutations [2 .. n])
  where
    es = S.fromList (map (\[a, b] -> (a, b)) abs)
    f ct xs
      | all (\(a,b) -> S.member (a, b) es || S.member (b, a) es) (zip (1:xs) xs) = ct + 1
      | otherwise = ct
