import Data.List
import qualified Data.Set as S
import Control.Monad

main :: IO ()
main = do
  [n, m] <- readInts
  es <- S.fromList $ replicateM m readInts
  print $ solve n es

readInts :: IO [Int]
readInts = map read . words <$> getLine

solve :: Int -> S.Set [Int] -> Int
solve n es = length $ filter (any (solve' es)) $ map (1 :) $ permutations [2..n]

solve' :: S.Set [Int] -> [Int] -> Bool
solve' es xs = all (solve'' es) $ zip xs (tail xs)

solve'' :: S.Set [Int] -> (Int, Int) -> Bool
solve'' es (x, y) = [x, y] `S.member` es || [y, x] `S.member` es
