import itertools



N, M = list(map(int, input().split()))

ab = [0] * M

for i in range(M):

  ab[i] = list(map(int, input().split()))



perms = itertools.permutations(list(range(1, N+1)))

ans = 0

for perm in perms:

  if perm[0] != 1:

    continue

  is_goal = True

  for i in range(N-1):

    a = perm[i]

    b = perm[i+1]

    if not a < b:

      a, b = b, a

    if not [a, b] in ab:

      is_goal = False

  if is_goal:

    ans += 1



print(ans)

# https://img.atcoder.jp/abc054/editorial.pdf



N, M = list(map(int, input().split()))



graph = [[False for _ in range(N)] for i in range(N)]

for i in range(M):

  a, b = list(map(int, input().split()))

  graph[a-1][b-1] = graph[b-1][a-1] = True



def dfs(v, visited):

  all_visited = True

  for i in range(N):

    if not visited[i]:

      all_visited = False

      

  if all_visited:

    return 1

  

  ret = 0

  for i in range(N):

    if not graph[v][i]: continue

    if visited[i]: continue

    

    visited[i] = True

    ret += dfs(i, visited)

    visited[i] = False

  

  return ret



visited = [False] * N

visited[0] = True

ans = dfs(0, visited)

print(ans)

import itertools

N, M = list(map(int, input().split()))
ab = [0] * M
for i in range(M):
    ab[i] = list(map(int, input().split()))
perms = itertools.permutations(list(range(1, N + 1)))
ans = 0
for perm in perms:
    if perm[0] != 1:
        continue
    is_goal = True
    for i in range(N - 1):
        a = perm[i]
        b = perm[i + 1]
        if not a < b:
            a, b = b, a
        if not [a, b] in ab:
            is_goal = False
    if is_goal:
        ans += 1
print(ans)

# https://img.atcoder.jp/abc054/editorial.pdf
N, M = list(map(int, input().split()))
graph = [[False for _ in range(N)] for i in range(N)]
for i in range(M):
    a, b = list(map(int, input().split()))
    graph[a - 1][b - 1] = graph[b - 1][a - 1] = True


def dfs(v, visited):
    all_visited = True
    for i in range(N):
        if not visited[i]:
            all_visited = False
    if all_visited:
        return 1
    ret = 0
    for i in range(N):
        if not graph[v][i]:
            continue
        if visited[i]:
            continue
        visited[i] = True
        ret += dfs(i, visited)
        visited[i] = False
    return ret


visited = [False] * N
visited[0] = True
ans = dfs(0, visited)
print(ans)

-import itertools +# https://img.atcoder.jp/abc054/editorial.pdf +N, M = list(map(int, input().split())) +graph = [[False for _ in range(N)] for i in range(N)] +for i in range(M): +    a, b = list(map(int, input().split())) +    graph[a - 1][b - 1] = graph[b - 1][a - 1] = True -N, M = list(map(int, input().split())) -ab = [0] * M -for i in range(M): -    ab[i] = list(map(int, input().split())) -perms = itertools.permutations(list(range(1, N + 1))) -ans = 0 -for perm in perms: -    if perm[0] != 1: -        continue -    is_goal = True -    for i in range(N - 1): -        a = perm[i] -        b = perm[i + 1] -        if not a < b: -            a, b = b, a -        if not [a, b] in ab: -            is_goal = False -    if is_goal: -        ans += 1 + +def dfs(v, visited): +    all_visited = True +    for i in range(N): +        if not visited[i]: +            all_visited = False +    if all_visited: +        return 1 +    ret = 0 +    for i in range(N): +        if not graph[v][i]: +            continue +        if visited[i]: +            continue +        visited[i] = True +        ret += dfs(i, visited) +        visited[i] = False +    return ret + + +visited = [False] * N +visited[0] = True +ans = dfs(0, visited)