import Control.Monad
import Control.Applicative

calcPath :: Int -> Int -> [(Int, Int)] -> IO Int
calcPath 0 _ _  = return 1
calcPath _ _ [] = return 0
calcPath l n xs = sum <$> (forM nextXs' $ (\i -> do
  --putStrLn $ show (l, n, xs ,nextXs, map snd nextXs')
  --(putStrLn . show) =<< calcPath 2 3 [(2,3),(3,4),(2,4)]
  calcPath (l - 1) i nextXs))
  where f x = (snd.includeN x) n
        nextXs  = [xs' | xs' <- xs, not.fst.includeN xs' $ n]
        nextXs' = [f y | y <- xs, fst.includeN y $ n] 

includeN :: (Int, Int) -> Int -> (Bool, Int)
includeN (x, y) n
  | x == n    = (True, y)
  | y == n    = (True, x)
  | otherwise = (False, 0)


main :: IO ()
main = do
  [n, m] <- map read . words <$> getLine
  numPares <- replicateM m $ do
              [a, b] <- map read . words <$> getLine
              return (a, b)
  putStrLn =<< (show <$> calcPath (n - 1) 1 numPares)