CodeEff/ECCO huggingface dataset:
# Original solution
n,x=list(map(int,input().split()))
List=list(map(int,input().split()))
List.sort()
ans=0
if sum(List)==x:
    print(n)
    exit()
else:
    for i in range(len(List)-1):
        if x>=List[i]:
            ans+=1
            x-=List[i]
        else:
            break
print(ans)

# Optimized solution
n,x=list(map(int,input().split()))
a=list(map(int,input().split()))
a.sort()
cnt=0
if sum(a)==x:
    print(n)
    exit()
else:
    for i in range(n-1):
        if a[i]<=x:
            x-=a[i]
            cnt+=1
print(cnt)
# Original solution
n, x = list(map(int, input().split()))
l = list(map(int, input().split()))
l.sort()

i = 0
ans = 0
while x > 0 and i<= n-1:
  if x >= l[i]:
    x -= l[i]
    if i == n-1:
      if x == 0:
        ans += 1
        break
      else:
        break
    else:
      i += 1
      ans += 1
  else:
    x = 0
    break
print(ans)
  


# Optimized solution
n, x = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
ans = 0
for i, a in enumerate(A):
    if i != n-1:
        if x >= a:
            ans += 1
            x -= a
        else:
            break
    else:
        if x == a:
            ans += 1
        else:
            break
print(ans)
# Original solution
# _*_ coding:utf-8 _*_
#  Atcoder_Beginners_Contest-
#  Atcoder_Grand_Contest-
#  TODO https://atcoder.jp/contests/abc/tasks/abc_
import time
from contextlib import contextmanager
# from time import sleep
@contextmanager
def timer(title):
	t0 = time.time()
	yield
	print(("{} - done in {:.0f}s".format(title,time.time()-t0) ))

def  countJoyChild(haveCookie,joyMeterList):
	joyMeterList.sort()
	childsCount = len(joyMeterList)
	sendCookieRangeMax = list(range(0,childsCount,+1))
	sendCookieChilds = 0
	for i in sendCookieRangeMax :
		haveCookie = haveCookie-joyMeterList[i]
		if 0 <= haveCookie:
			sendCookieChilds = sendCookieChilds + 1
		else:
			break
	if 0 < haveCookie: # => 最後の一人が多すぎる
		sendCookieChilds = sendCookieChilds - 1

	answer = sendCookieChilds
	return answer


if __name__ == '__main__':
	_,X = list(map(int,input().strip().split(' ')))
	A = list(map(int,input().strip().split(' ')))
#	with timer("countJoyChild"):
	solution=countJoyChild(X,A)
	print(("{}".format(solution)))

# Optimized solution
# _*_ coding:utf-8 _*_
#  Atcoder_Grand_Contest027-a
#  https://atcoder.jp/contests/agc027/tasks/agc027_a

def  countJoyChild(haveCookie,joyMeterList):
	joyMeterList.sort()
	childsCount = len(joyMeterList)
	sendCookieRangeMax = list(range(0,childsCount,+1))
	sendCookieChilds = 0
	for i in sendCookieRangeMax :
		haveCookie = haveCookie-joyMeterList[i]
		if 0 <= haveCookie:
			sendCookieChilds = sendCookieChilds + 1
		else:
			break
	if 0 < haveCookie: # => 最後の一人が多すぎる
		sendCookieChilds = sendCookieChilds - 1

	answer = sendCookieChilds
	return answer


if __name__ == '__main__':
	_,X = list(map(int,input().strip().split(' ')))
	A = list(map(int,input().strip().split(' ')))
	solution=countJoyChild(X,A)
	print(("{}".format(solution)))
# Original solution
n,x= list(map(int, input().split()))
a= sorted(list(map(int, input().split())))
cnt=0
for i in range(n):
    if x>=a[i]:
        cnt+=1
        x-=a[i]
    else:
        break
    if i==n-1 and x>0:
        cnt-=1
print(cnt)

# Optimized solution
n,x=list(map(int,input().split()))
a=sorted(list(map(int,input().split())))
if a[0]>x:
    print((0))
    exit()
cnt=1
for i in range(1,n):
    a[i]+=a[i-1]
    if a[i]>x:
        break
    cnt+=1
if cnt==n and a[-1]!=x:
    cnt-=1
print(cnt)
# Original solution
N, x = list(map(int, input().split()))
a = sorted(map(int, input().split()))
ans = 0
for i in range(N):
    if x >= a[i]:
        ans += 1
        x -= a[i]
    else:
        break
    if i == N - 1:
        if x != 0:
            ans -= 1
print(ans)

# Optimized solution
n, x = list(map(int, input().split()))
a = sorted(map(int, input().split()))
ans = 0
for i in range(n):
    x -= a[i]
    if x < 0:
        break
    if i == n-1:
        if x > 0:
            break
    ans += 1

print(ans)
# Original solution
n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
ans = 0
if x > sum(a):
        print((n-1))
else:
        for _a in a:
                x -= _a
                if x < 0:
                        print(ans)
                        exit()
                else:
                        ans += 1
        print(ans)

# Optimized solution
n, x = list(map(int, input().split()))
A = list(map(int, input().split()))

A.sort()
ans = 0
for a in A:
    x -= a
    if x < 0:
        break
    else:
        ans += 1
if 0 < x:
    ans -= 1

print((max(ans, 0)))
# Original solution
import itertools
n,x=list(map(int,input().split()))
a=list(map(int, input().split()))
if sum(a)<x:
    print((len(a)-1))
else:
    ans=0
    for i in range(1,n+1):
        for v in itertools.combinations(a,i):
            if sum(v)<=x:
                ans=len(v)
    print(ans)

# Optimized solution
n,x=list(map(int,input().split()))
a=list(map(int, input().split()))

ans=0
rest=x
target=sorted(a)
if sum(target)<x:
    print((n-1))
elif sum(target)==x:
    print(n)
else:
    for i in range(n):
        rest-=target[i]
        if rest<0:
            ans=i
            break
        if rest==0:
            ans=i+1
            break
    print(ans)
# Original solution
N,x = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

if x < min(A):
    print((0))
    exit()

A.sort()
ans = 0
i = 0
while x > 0 and ans < N:
    if x >= A[i]:
        x -= A[i]
        ans += 1
        i += 1

if x > 0:
    ans -= 1

print(ans)


# Optimized solution
N,x = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

if x < min(A):
    print((0))
    exit()

A.sort()
ans = 0
i = 0
while x > 0 and ans < N:
    if x >= A[i]:
        x -= A[i]
        ans += 1
        i += 1
    else:
        x = 0
        break

if x > 0:
    ans -= 1

print(ans)
# Original solution
n, x = [int(i) for i in input().split()]
A = sorted([int(i) for i in input().split()])

ans = 0
for i in range(n):
    if A[i] <= x:
        if i == n - 1:
            if x == A[i]:
                ans += 1
        else:
            x -= A[i]
            ans += 1
    else:
        break
print(ans)


# Optimized solution
# https://atcoder.jp/contests/agc027/tasks/agc027_a
n, x = [int(i) for i in input().split()]
A = sorted([int(i) for i in input().split()])

if sum(A) == x:
    ans = n
elif sum(A) < x:
    ans = n - 1
else:
    ans = 0
    for i in range(n):
        if A[i] <= x:
            if i == n - 1:
                if x == A[i]:
                    ans += 1
            else:
                x -= A[i]
                ans += 1
        else:
            continue

print(ans)
# Original solution
import itertools
n,x=list(map(int,input().split()))
a=list(map(int,input().split()))
a.append(0)
comb=list(itertools.combinations_with_replacement(a,n))
ans=[]
for i in comb:
    per=sum(i)
    if per==x:
        if 0 in i:
            ans.append(len(set(i))-1)
        else:
            ans.append(len(set(i)))
if len(ans)==0:
    print((0))
else:
    print((max(ans)))


# Optimized solution
cnt=0
n,x=list(map(int,input().split()))
a=list(map(int,input().split()))
a.sort()
for i,j in enumerate(a):
    if x>=j:
        x-=j
        cnt+=1
        if i==(n-1) and x>0:
            cnt-=1
print(cnt)
# Original solution
n,x=list(map(int,input().split()))
a=sorted(list(map(int,input().split())))
ans=0
for i in range(n):
    if x>=a[i]:
        ans+=1
        x-=a[i]
    else:
        break
if ans == n:
    if x!=0:
        ans-=1
print(ans)

# Optimized solution
n,x=list(map(int,input().split()))
a=sorted(list(map(int,input().split())))
ans=0
a.sort()
for i in range(n):
    if x>=a[i]:
        if i == n-1:
            if a[i]==x:
                ans+=1
        else:
            x-=a[i]
            ans+=1
    else:
        break
print(ans)
# Original solution

N, V = list(map(int, input().split()))
C = list(map(int, input().split()))
assert len(C)==N

W = [1 for i in range(N)]
F = [0 for i in range(V+1)]

def pack01(F, c, w):
    """
    f: states
    c: cost
    w: value

    v: volume
    """
    for v in range(c, V+1)[::-1]:
        F[v] = max(F[v], F[v-c]+w)
for i in range(N):
    pack01(F, C[i], W[i])

s = sum(C)
if s==V or s>V:
    print((F[-1]))
elif sum(C)<V:
    print((F[-1]-1))
    

# Optimized solution
N, V = list(map(int, input().split()))
C = list(map(int, input().split()))
N = len(C)

if sum(C)==V:
  print(N)
else:
  cnt = 0
  for c in sorted(C):
    if V-c>0:
      cnt += 1
      V -= c
    elif V-c==0:
      cnt += 1
      break
    else:
      break
  print((min(cnt, N-1)))
# Original solution
N, x = list(map(int, input().split()))
a = list(map(int, input().split()))

ans = 0
use_list = []
for i in range(2**N):
    use_list.append(list(map(int, list(bin(i)[2::].zfill(N)))))
for u in use_list:
    s = 0
    
    for i in range(N):
        if u[i] == 1:
            s += a[i]
    if s < x:
        ans = max(ans, sum(u)-1)
    elif s == x:
        ans = max(ans, sum(u))
print(ans)

# Optimized solution
N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
dp = [[]]
a.sort()
ans = 0
f = False
for b in a:
    if b <= x:
        ans += 1
        x -= b
        f = True
    else:
        f = False
if x > 0 and f:
    ans -= 1
print(ans)
# Original solution
n, x = list(map(int, input().split()))
a = sorted(list(map(int, input().split())))

cnt = 0
flag = False
for i in a:
    if i <= x:
        x -= i
        cnt += 1
        if x == 0:
            flag = True
    else:
        break
else:
    if not flag:
        cnt -= 1
print(cnt)

# Optimized solution
n, x = list(map(int, input().split()))
a = sorted(list(map(int, input().split())))

cnt = 0
flag = False
for i in a:
    if i <= x:
        x -= i
        cnt += 1
        if x == 0:
            break
    else:
        break
else:
    cnt -= 1
print(cnt)
# Original solution
from collections import Counter,defaultdict,deque
from heapq import heapify,heappop,heappush
import sys,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,x = inpl()
a = inpl()
a.sort()
if sum(a) < x:
    print((n-1))
else:
    s = 0
    for i,y in enumerate(a):
        # print(i,y)
        if s + y < x:
            s += y
        elif s + y == x:
            print((i+1))
            break
        else:
            print(i)
            break
    else:
        print((n-1))

# Optimized solution
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,x = inpl()
a = inpl()
a.sort()
for i in range(n):
    if a[i] <= x:
        x -= a[i]
    else:
        print(i)
        break
else:
    if x == 0:
        print(n)
    else:
        print((n-1))
# Original solution
n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
count = 0
for i in range(n):
    if i == n-1:
        if x == a[i]:
            count += 1
    elif x >= a[i]:
        count += 1
        x -= a[i]
print(count)

# Optimized solution
n,x = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
cnt = 0
while a[cnt] <= x:
    x = x - a[cnt]
    cnt += 1
    if cnt >= len(a):
        break
if x > 0 and len(a) == cnt:
    cnt -= 1
print(cnt)
# Original solution
N, x = [int(i) for i in input().split(" ")]
lst = [int(i) for i in input().split(" ")]
 
lst.sort()
cnt = 0
 
for i in range(0,N-1):
  if x >= lst[i]:
    x -= lst[i]
    cnt += 1
  else:
    break

if x == lst[N-1]:
    cnt +=1
    
print(cnt)

# Optimized solution
N, x = [int(i) for i in input().split(" ")]
lst = [int(i) for i in input().split(" ")]
 
lst.sort()
cnt = 0
 
for i in range(0,N-1):
  if x >= lst[i]:
    x -= lst[i]
    cnt += 1
  else:
    break

    
print((cnt+(x==lst[N-1])))
# Original solution
import sys
input = lambda :sys.stdin.readline().rstrip()

N, x = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))

if x > sum(A):
  cnt = -1
else:
  cnt = 0
  
for i in range(N):
    if x - A[i] >= 0:
        cnt += 1
        x -= A[i]
    if x <= 0:
        break
    #print(cnt, x)

print(cnt)

# Optimized solution
n, x = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))

if sum(A) < x:
    cnt = -1
else:
    cnt = 0
    
for a in A:
    x -= a
    if x >= 0:
        cnt += 1
    if x <= 0:
        print(cnt)
        exit()
print(cnt)
# Original solution
#!/usr/bin/env python

n, x = list(map(int, input().split()))
a = list(map(int, input().split()))

a = sorted(a)
if x < a[0]:
    print((0))
    exit()

cnt = 0 
al = False
for i in range(n):
    if x >= a[i]:
        x -= a[i]
        cnt += 1
    else:
        break
    if i == n-1:
        al = True

if al: 
    if x > 0:
        ans = cnt-1
    else:
        ans = cnt 
else:
    ans = cnt 

print(ans)


# Optimized solution
#!/usr/bin/env python

n, x = list(map(int, input().split()))
a = list(map(int, input().split()))

a = sorted(a)
if x < a[0]:
    print((0))
    exit()

if sum(a) < x:
    print((n-1))
    exit()

cnt = 0 
for i in range(n):
    if x >= a[i]:
        x -= a[i]
        cnt += 1

ans = cnt 
print(ans)
# Original solution
from itertools import permutations
n, m = list(map(int, input().split()))
list_AB = [ list(map(int,input().split(" "))) for i in range(m)]
list_MAP = [[0]*n for _ in range(n)]
list_N = [i for i in range(2, n+1)]

for a, b in list_AB:
    list_MAP[a-1][b-1] = 1
    list_MAP[b-1][a-1] = 1

ans = 0

for l in permutations(list_N, n-1):
    cnt = 0
    p = 1
    q = 0
    for num in l:
        q = num
        cnt += list_MAP[p-1][q-1]
        p = num

    if cnt == n-1:
        ans += 1

print(ans)

# Optimized solution
n, m = list(map(int, input().split()))
list_MAP = [[0]*n for _ in range(n)]
for _ in range(m):
    a, b = list(map(int, input().split()))
    list_MAP[a-1][b-1] = 1
    list_MAP[b-1][a-1] = 1

dp = [[0]*n for _ in range(1<<n)]
dp[1][0] = 1
for num in range(1<<n):
    for v in range(n):
        if num & (1<<v) == 0:
            continue
        sub = num ^ (1<<v)

        for u in range(n):
            if sub & (1<<u) and list_MAP[v][u]:
                dp[num][v] += dp[sub][u]
ans = sum(dp[(1 << n) - 1][u] for u in range(1, n))
print(ans)
# Original solution
n, m = list(map(int, input().split()))
list_MAP = [[0]*n for _ in range(n)]
for _ in range(m):
    a, b = list(map(int, input().split()))
    list_MAP[a-1][b-1] = 1
    list_MAP[b-1][a-1] = 1

dp = [[0]*n for _ in range(1<<n)]
dp[1][0] = 1
for num in range(1<<n):
    for v in range(n):
        if num & (1<<v) == 0:
            continue
        sub = num ^ (1<<v)

        for u in range(n):
            if sub & (1<<u) and list_MAP[v][u]:
                dp[num][v] += dp[sub][u]
ans = sum(dp[(1 << n) - 1][u] for u in range(1, n))
print(ans)

# Optimized solution
n, m = list(map(int, input().split()))
list_MAP = [[0]*n for _ in range(n)]
for _ in range(m):
    a, b = list(map(int, input().split()))
    list_MAP[a-1][b-1] = 1
    list_MAP[b-1][a-1] = 1

dp = [[0]*n for _ in range(1<<n)]
dp[1][0] = 1
for num in range(1<<n):
    for v in range(n):
        if num & (1<<v) == 0:
            continue
        sub = num ^ (1<<v)

        for u in range(n):
            if sub & (1<<u) and list_MAP[v][u]:
                dp[num][v] += dp[sub][u]
ans = sum(dp[(1 << n) - 1])
print(ans)
# Original solution
import itertools

n, m = list(map(int, input().split()))
AB = []
for i in range(m):
    AB.append(list(map(int, input().split())))
ct = 0
N_lis = [(i + 2) for i in range(n - 1)]
Pat = itertools.permutations(N_lis)
for one_case in Pat:
    tmp = 1
    all_flag = True
    for j in one_case:
        flag = False
        for k in range(m):
            if AB[k][0] == tmp:
                if AB[k][1] == j:
                    tmp = j
                    flag = True
                    break
            elif AB[k][1] == tmp:
                if AB[k][0] == j:
                    tmp = j
                    flag = True
                    break
        if not flag:
            all_flag = False
            break
    if all_flag:
        ct += 1
print(ct)

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

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

#dp[S][v] := 頂点０から出発し、集合Sに含まれる頂点を全て訪れるpathのうち、頂点vが最後になるようなpathの総数
dp = [[0] * n for _ in range(1 << n)]

#dpの初期化 dp({0}, 0) = 1
dp[1][0] = 1

for S in range(1 << n):
    for v in range(n):
        #vがSに含まれていないときはパスする
        if S & (1 << v) == 0:
            continue
        
        #sub = S - {v}
        sub = S ^ (1 << v)
        
        for u in range(n):
            #subにuが含まれており、かつuとvが辺で結ばれている
            if sub & (1 << u) and P[u][v]:
                dp[S][v] += dp[sub][u]

ans = sum(dp[(1 << n) - 1][u] for u in range(1, n))
print(ans)
# Original solution
import copy
n,m = list(map(int, input().split()))


paths = [[] for _ in range(n)]
for i in range(m):
  a,b = list(map(int, input().split()))
  paths[a-1].append(b-1)
  paths[b-1].append(a-1)
  
ans = 0

checked = [False for _ in range(n)]


def solve(i, c):
  c[i] = True

  global ans
  if c.count(False) == 0:
    ans += 1
    return
  else:
    for j in paths[i]:
      if c[j] == False: 
        solve(j, copy.deepcopy(c))
        
      

        
solve(0, copy.deepcopy(checked))
print(ans)
    
#print(paths[0])

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

if M == 0:
    print((0))
    exit()

es = [[] for i in range(M+1)]
for i in range(M):
    a, b = list(map(int, input().split()))
    a,b = a-1, b-1
    es[a].append(b)
    es[b].append(a)

def dfs(v, visited, es, cnt):

    #print("--------------")
    #print((v, visited, cnt))

    if cnt == N-1:
        return 1
    ret = 0
    for i in es[v]:
        if visited[i] == True:
            continue

        visited[i] = True
        ret += dfs(i, visited, es, cnt+1)
        visited[i] = False

    return ret

visited = [False] * N
visited[0] = True

ans = dfs(0,visited,es,0)
print(ans)
# Original solution
def perm(k,x):
    v=[]
    for i in range(x):
        c=k%x+2
        if c not in v:
            v.append(c)
            k//=x
        else:
            return []
    return v       

N,M=list(map(int,input().split()))
e=[[False for i in range(N+1)] for i in range(N+1)]
for i in range(M):
    a,b=list(map(int,input().split()))
    e[a][b]=e[b][a]=True

if N==2:
    ans=1 if e[1][2] else 0
else:
    ans=0
    for k in range((N-1)**(N-1)):
        v=perm(k,N-1)
        if v and e[1][v[0]]:
            f=True
            for j in range(N-2):
                if not e[v[j]][v[j+1]]:
                    f=False
                    break
                if j==N-3:
                    ans+=1

print(ans)

# Optimized solution
import itertools as it

N,M=list(map(int,input().split()))
e=[[False for j in range(N+1)] for i in range(N+1)]
for i in range(M):
    a,b=list(map(int,input().split()))
    e[a][b]=e[b][a]=True
# print(e) #DB

ans=0
l=list(range(2,N+1))
for p in it.permutations(l,N-1):
    q=(1,)+p    
    # print(q) #DB
    f=True
    for i in range(N-1):
        # print((q[i],q[i+1])) #DB
        if not e[q[i]][q[i+1]]:
            f=False
            break
    if f:
        ans+=1

print(ans)
# Original solution
from typing import List, Tuple


def main():
    n, m = list(map(int, input().split()))
    g = []
    for _ in range(m):
        a, b = list(map(int, input().split()))
        g.append((a, b))
    print((osp(n, g)))


def osp(n: int, g: List[Tuple[int, int]]) -> int:
    v = [False] * n

    return dfs(0, v, n, g)


def dfs(i, v, n, g):
    v[i] = True
    if all(v):
        v[i] = False
        return 1

    cnt = 0
    for j in range(n):
        if v[j]:
            continue
        if not ((i + 1, j + 1) in g or (j + 1, i + 1) in g):
            continue
        cnt += dfs(j, v, n, g)

    v[i] = False
    return cnt


if __name__ == '__main__':
    main()


# Optimized solution
from typing import List, Tuple


def main():
    n, m = list(map(int, input().split()))
    g = []
    for _ in range(m):
        a, b = list(map(int, input().split()))
        g.append((a, b))
    print((osp(n, g)))


def osp(n: int, g: List[Tuple[int, int]]) -> int:
    v = [False] * n
    g = set(g)

    return dfs(0, v, n, g)


def dfs(i, v, n, g):
    v[i] = True
    if all(v):
        v[i] = False
        return 1

    cnt = 0
    for j in range(n):
        if v[j]:
            continue
        if not ((i + 1, j + 1) in g or (j + 1, i + 1) in g):
            continue
        cnt += dfs(j, v, n, g)

    v[i] = False
    return cnt


if __name__ == '__main__':
    main()
# Original solution
ans = 0
def dfs(v, visitedNode, graph):
    visitedNode[v] = 1
    if all(visitedNode):
        global ans
        ans += 1
        return
    for node in graph[v]:
        if visitedNode[node]:
            continue
        else:
            dfs(node, visitedNode[:], graph)


N, M = list(map(int, input().split()))
v = 0
visitedNode = [0] * N


# 隣接リストを作成する
graph = [[] for _ in range(N)]
for _ in range(M):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)


# 深さ優先探索で経路数を数える
dfs(v, visitedNode, graph)
print(ans)


# Optimized solution
ans = 0
def dfs(v, visitedNode, graph):
    visitedNode[v] = 1
    # print(visitedNode)
    if all(visitedNode):
        global ans
        ans += 1
        return
    for node in graph[v]:
        if visitedNode[node]:
            # 探索済みならば、ほかの隣接候補へ。
            continue
        else:
            # 未探索ならば、次の階層を調べる。
            dfs(node, visitedNode[:], graph)


N, M = list(map(int, input().split()))
v = 0
visitedNode = [0] * N


graph = [[] for _ in range(N)]
for _ in range(M):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)
# print(graph)


dfs(v, visitedNode, graph)
print(ans)
# Original solution

n,m=list(map(int, input().split()))
q=[]
for i in range(m):
    a,b=list(map(int, input().split()))
    q.append([a,b])
    q.append([b,a])
p=[[1]]
count=0
route=set()
while len(p)!=0:
    p1=p.pop()
    for i,j in q:
        #print(i,j)
        if i == p1[-1]:
            if j not in p1:
                p.append(p1+[j])
    if len(p1)==n: count+=1
    route |= {tuple(p1)}
    #print(p,p1)
print(count)

# Optimized solution
n,m=list(map(int, input().split()))
q=[]
for i in range(m):
    a,b=list(map(int, input().split()))
    q+=[[a,b],[b,a]]
p=[[1]]
count=0
while p:
    p1=p.pop()
    if len(p1)==n:count+=1
    else:
        for i,j in q:
            if i == p1[-1] and j not in p1:
                p.append(p1+[j])
    #print(p1,p)
print(count)