# -*- coding: utf-8 -*-



import copy



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

rinset = [[0]*(n+1) for _ in range(n+1)]

for _ in range(m):

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

    rinset[a][b]=b

    rinset[b][a]=a

cnt = 0

def solve(start,visitted):

    global cnt

    visitted = copy.deepcopy(visitted)

    visitted.append(start)

    if len(visitted) == n:

        cnt+=1

        return

    next_start=[i for i in rinset[start] if (i>1 and i not in visitted)]

    for i in next_start:

        solve(i,visitted)



solve(1,[])

print(cnt)

# -*- coding: utf-8 -*-

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

ab = [list(map(int,input().split())) for i in range(m)]



#逆順にしたもの追加

ab += [[b,a] for a,b in ab]



#辺id付きで、idがfrom,abi[from]=[to1,to2,...] のリスト

abi = [[] for _ in range(n+1)]

for i,(a,b) in enumerate(ab):

    abi[a].append(b)







#再起のlimitを上げる

import sys

sys.setrecursionlimit(4100000)



def dfs(idx=1,visitted=[1],cnt=1):

    ret = 0

    if cnt==n:

        return 1

    for to in abi[idx]:

        if to not in visitted:

            ret += dfs(to,visitted+[to],cnt+1)

    return ret

print((dfs()))
# -*- coding: utf-8 -*-
import copy

n, m = list(map(int, input().split()))
rinset = [[0] * (n + 1) for _ in range(n + 1)]
for _ in range(m):
    a, b = list(map(int, input().split()))
    rinset[a][b] = b
    rinset[b][a] = a
cnt = 0


def solve(start, visitted):
    global cnt
    visitted = copy.deepcopy(visitted)
    visitted.append(start)
    if len(visitted) == n:
        cnt += 1
        return
    next_start = [i for i in rinset[start] if (i > 1 and i not in visitted)]
    for i in next_start:
        solve(i, visitted)


solve(1, [])
print(cnt)

# -*- coding: utf-8 -*-
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]
# 逆順にしたもの追加
ab += [[b, a] for a, b in ab]
# 辺id付きで、idがfrom,abi[from]=[to1,to2,...] のリスト
abi = [[] for _ in range(n + 1)]
for i, (a, b) in enumerate(ab):
    abi[a].append(b)
# 再起のlimitを上げる
import sys

sys.setrecursionlimit(4100000)


def dfs(idx=1, visitted=[1], cnt=1):
    ret = 0
    if cnt == n:
        return 1
    for to in abi[idx]:
        if to not in visitted:
            ret += dfs(to, visitted + [to], cnt + 1)
    return ret


print((dfs()))

-import copy +n, m = list(map(int, input().split())) +ab = [list(map(int, input().split())) for i in range(m)] +# 逆順にしたもの追加 +ab += [[b, a] for a, b in ab] +# 辺id付きで、idがfrom,abi[from]=[to1,to2,...] のリスト +abi = [[] for _ in range(n + 1)] +for i, (a, b) in enumerate(ab): +    abi[a].append(b) +# 再起のlimitを上げる +import sys -n, m = list(map(int, input().split())) -rinset = [[0] * (n + 1) for _ in range(n + 1)] -for _ in range(m): -    a, b = list(map(int, input().split())) -    rinset[a][b] = b -    rinset[b][a] = a -cnt = 0 +sys.setrecursionlimit(4100000) -def solve(start, visitted): -    global cnt -    visitted = copy.deepcopy(visitted) -    visitted.append(start) -    if len(visitted) == n: -        cnt += 1 -        return -    next_start = [i for i in rinset[start] if (i > 1 and i not in visitted)] -    for i in next_start: -        solve(i, visitted) +def dfs(idx=1, visitted=[1], cnt=1): +    ret = 0 +    if cnt == n: +        return 1 +    for to in abi[idx]: +        if to not in visitted: +            ret += dfs(to, visitted + [to], cnt + 1) +    return ret -solve(1, []) -print(cnt) +print((dfs()))