import itertools



n, m = list(map(int, input().split()))

path = [[False] * n for i in range(n)]



for i in range(m):

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

    a -= 1

    b -= 1

    path[a][b] = True

    path[b][a] = True



    ans = 0



for i in itertools.permutations(list(range(n)), n):

    # 頂点1が始点

    if i[0] == 0:

        for j in range(n):

            if j == n - 1:

                ans += 1

                break

            if not path[i[j]][i[j + 1]]:

                break



print(ans)

def main():

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

    matrix = [[0] * N for _ in range(N)]



    for _ in range(M):

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

        matrix[a-1][b-1] = 1

        matrix[b-1][a-1] = 1



    def dfs(v, used):

        if False not in used:

            return 1



        ans = 0

        for i in range(N):

            if not matrix[v][i]:

                continue

            if used[i]:

                continue



            used[i] = True

            ans += dfs(i, used)

            used[i] = False



        return ans



    used = [False] * N

    used[0] = True



    print((dfs(0, used)))





if __name__ == '__main__':

    main()

import itertools

n, m = list(map(int, input().split()))
path = [[False] * n for i in range(n)]
for i in range(m):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    path[a][b] = True
    path[b][a] = True
    ans = 0
for i in itertools.permutations(list(range(n)), n):
    # 頂点1が始点
    if i[0] == 0:
        for j in range(n):
            if j == n - 1:
                ans += 1
                break
            if not path[i[j]][i[j + 1]]:
                break
print(ans)

def main():
    N, M = list(map(int, input().split()))
    matrix = [[0] * N for _ in range(N)]
    for _ in range(M):
        a, b = list(map(int, input().split()))
        matrix[a - 1][b - 1] = 1
        matrix[b - 1][a - 1] = 1

    def dfs(v, used):
        if False not in used:
            return 1
        ans = 0
        for i in range(N):
            if not matrix[v][i]:
                continue
            if used[i]:
                continue
            used[i] = True
            ans += dfs(i, used)
            used[i] = False
        return ans

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


if __name__ == "__main__":
    main()

-import itertools +def main(): +    N, M = list(map(int, input().split())) +    matrix = [[0] * N for _ in range(N)] +    for _ in range(M): +        a, b = list(map(int, input().split())) +        matrix[a - 1][b - 1] = 1 +        matrix[b - 1][a - 1] = 1 -n, m = list(map(int, input().split())) -path = [[False] * n for i in range(n)] -for i in range(m): -    a, b = list(map(int, input().split())) -    a -= 1 -    b -= 1 -    path[a][b] = True -    path[b][a] = True -    ans = 0 -for i in itertools.permutations(list(range(n)), n): -    # 頂点1が始点 -    if i[0] == 0: -        for j in range(n): -            if j == n - 1: -                ans += 1 -                break -            if not path[i[j]][i[j + 1]]: -                break -print(ans) +    def dfs(v, used): +        if False not in used: +            return 1 +        ans = 0 +        for i in range(N): +            if not matrix[v][i]: +                continue +            if used[i]: +                continue +            used[i] = True +            ans += dfs(i, used) +            used[i] = False +        return ans + +    used = [False] * N +    used[0] = True +    print((dfs(0, used))) + + +if __name__ == "__main__": +    main()