from collections import defaultdict

from itertools import permutations



def main():

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

    g = defaultdict(list)

    for _ in range(M):

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

        g[a].append(b)

        g[b].append(a)



    ans = 0

    for route in permutations(list(range(2, N + 1)), N - 1):

        ok = True

        now = 1

        for r in route:

            if r in g[now]:

                now = r

            else:

                ok = False

        if ok:

            ans += 1



    print(ans)





if __name__ == '__main__':

    main()

from collections import defaultdict

from itertools import permutations





def main():

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

    graph = defaultdict(list)

    for _ in range(M):

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

        graph[a].append(b)

        graph[b].append(a)



    ans = 0

    for route in permutations(list(range(2, N + 1)), N - 1):

        ok = True

        now = 1

        for node in route:

            if node in graph[now]:

                now = node

            else:

                ok = False

        ans += ok



    print(ans)





if __name__ == '__main__':

    main()

from collections import defaultdict
from itertools import permutations


def main():
    N, M = list(map(int, input().split()))
    g = defaultdict(list)
    for _ in range(M):
        a, b = list(map(int, input().split()))
        g[a].append(b)
        g[b].append(a)
    ans = 0
    for route in permutations(list(range(2, N + 1)), N - 1):
        ok = True
        now = 1
        for r in route:
            if r in g[now]:
                now = r
            else:
                ok = False
        if ok:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

from collections import defaultdict
from itertools import permutations


def main():
    N, M = list(map(int, input().split()))
    graph = defaultdict(list)
    for _ in range(M):
        a, b = list(map(int, input().split()))
        graph[a].append(b)
        graph[b].append(a)
    ans = 0
    for route in permutations(list(range(2, N + 1)), N - 1):
        ok = True
        now = 1
        for node in route:
            if node in graph[now]:
                now = node
            else:
                ok = False
        ans += ok
    print(ans)


if __name__ == "__main__":
    main()

-    g = defaultdict(list) +    graph = defaultdict(list) -        g[a].append(b) -        g[b].append(a) +        graph[a].append(b) +        graph[b].append(a) -        for r in route: -            if r in g[now]: -                now = r +        for node in route: +            if node in graph[now]: +                now = node -        if ok: -            ans += 1 +        ans += ok