import Data.List
import qualified Data.Vector as V
import qualified Data.IntSet as IS
main=print.solve.map(map read.words).lines=<<getContents
solve([n,m]:ab)=length.filter(f.(0:))$permutations[1..n-1]where
  g=V.accum(flip IS.insert)(V.replicate n IS.empty)$concatMap(\[a,b]->[(a-1,b-1),(b-1,a-1)])ab
  f=all(\(a,b)->IS.member a$g V.! b).(zip=<<tail)