import Control.Monad
main = do
 [n,m]<-map read . words <$> getLine
 asbs <- replicateM m $ map (read::String-> Int) .words <$> getLine
 let edges = asbs ++ (map reverse asbs)
 putStr $ show $ length (f [[1]] edges (n - 1))
 
next v es = [b| [a,b]<-es , a == v]
g p es = [v:p|v<- next (p!!0) es, not $ v `elem` p]
f::[[Int]]->[[Int]]->Int->[[Int]]
f ps es 0 = ps 
f ps es n = f (concat (map (flip g es) ps)) es (n-1)
