integer N,M
integer a,b
integer,allocatable,dimension(:,:)::graph
integer,allocatable,dimension(:)::visited
read*,N,M
allocate(graph(N,N),visited(N))
graph=0;visited=0
do i=1,M
  read*,A,B
  graph(A,B)=1
  graph(B,A)=1
end do
visited(1)=1
print*,DFS(1,N,visited)
contains
recursive function DFS(node,N,visited)result(res)
  implicit none
  integer::node,N,i
  integer,dimension(:)::visited(N)
  integer res
  res=0
  if(allpoint(N,visited))then
    res=1
    return
  endif
  do i=1,N
    if(graph(node,i)==1 .and. visited(i)/=1 )then
      visited(i)=1
      res=res+dfs(i,N,visited)
      visited(i)=0
    endif
  end do
  return
end function
function allpoint(N,visited)
  integer N
  integer,dimension(:)::visited(N)
  logical allpoint
  allpoint=.true.
  do i=1,N
    allpoint=allpoint.and.(visited(i)==1)
  end do
end function
end