import sys

from itertools import permutations



def solve():

    input = sys.stdin.readline

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

    Edge = [[] for _ in range(N)]

    for _ in range(M):

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

        Edge[a-1].append(b-1)

        Edge[b-1].append(a-1)



    count = 0

    for s in permutations(list(range(N)), N):

        Visited = [False for _ in range(N)]

        for i, n in enumerate(s):

            if i == 0:

                if n != 0: break

                else: Visited[0] = True

            else:

                if n in Edge[s[i-1]]: Visited[n] = True

                else: break

        else: count += 1

    print(count)



    return 0



if __name__ == "__main__":

    solve()
import sys

from itertools import permutations



def solve():

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

    Edge = [[] for _ in range(N)]

    for _ in range(M):

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

        Edge[a-1].append(b-1)

        Edge[b-1].append(a-1)

    count = 0

    for order in permutations(list(range(N))):

        if order[0] != 0: continue

        for i in range(N-1):

            if order[i+1] not in Edge[order[i]]: break

        else: count += 1

    print(count)



    return 0



if __name__ == "__main__":

    solve()
import sys
from itertools import permutations


def solve():
    input = sys.stdin.readline
    N, M = list(map(int, input().split()))
    Edge = [[] for _ in range(N)]
    for _ in range(M):
        a, b = list(map(int, input().split()))
        Edge[a - 1].append(b - 1)
        Edge[b - 1].append(a - 1)
    count = 0
    for s in permutations(list(range(N)), N):
        Visited = [False for _ in range(N)]
        for i, n in enumerate(s):
            if i == 0:
                if n != 0:
                    break
                else:
                    Visited[0] = True
            else:
                if n in Edge[s[i - 1]]:
                    Visited[n] = True
                else:
                    break
        else:
            count += 1
    print(count)
    return 0


if __name__ == "__main__":
    solve()

import sys
from itertools import permutations


def solve():
    N, M = list(map(int, input().split()))
    Edge = [[] for _ in range(N)]
    for _ in range(M):
        a, b = list(map(int, input().split()))
        Edge[a - 1].append(b - 1)
        Edge[b - 1].append(a - 1)
    count = 0
    for order in permutations(list(range(N))):
        if order[0] != 0:
            continue
        for i in range(N - 1):
            if order[i + 1] not in Edge[order[i]]:
                break
        else:
            count += 1
    print(count)
    return 0


if __name__ == "__main__":
    solve()

-    input = sys.stdin.readline -    for s in permutations(list(range(N)), N): -        Visited = [False for _ in range(N)] -        for i, n in enumerate(s): -            if i == 0: -                if n != 0: -                    break -                else: -                    Visited[0] = True -            else: -                if n in Edge[s[i - 1]]: -                    Visited[n] = True -                else: -                    break +    for order in permutations(list(range(N))): +        if order[0] != 0: +            continue +        for i in range(N - 1): +            if order[i + 1] not in Edge[order[i]]: +                break