n,m=map(int,input().split())
C=set(map(int,input().split()))

ANSLIST=[n]*(n+1)

ANSLIST[0]=0

for i in range(1,n+1):
    ANSLIST[i]=min([ANSLIST[i-c]+1  for c in C if i-c>=0])

print(ANSLIST[n]) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m C=set(map(int,input().split())) C set(map(int,input().split())) set map(int,input().split()) map int input().split() ().split () input split ANSLIST=[n]*(n+1) ANSLIST [n]*(n+1) [n] n n+1 n 1 ANSLIST[0]=0 ANSLIST[0] ANSLIST 0 0 for i in range(1,n+1):
    ANSLIST[i]=min([ANSLIST[i-c]+1  for c in C if i-c>=0]) i range(1,n+1) range 1 n+1 n 1 ANSLIST[i-c]+1  for c in C if i-c>=0 for c in C if i-c>=0 c C i-c>=0 i-c i c 0 if i-c>=0 ANSLIST[i-c]+1 ANSLIST[i-c] ANSLIST i-c i c 1 ANSLIST[i]=min([ANSLIST[i-c]+1  for c in C if i-c>=0]) ANSLIST[i] ANSLIST i min([ANSLIST[i-c]+1  for c in C if i-c>=0]) min [ANSLIST[i-c]+1  for c in C if i-c>=0] print(ANSLIST[n]) print ANSLIST[n] ANSLIST n m=map(int,input().split()) map(int,input().split()) m n,m=map(int,input().split()) map(int,input().split()) n C=set(map(int,input().split())) set(map(int,input().split())) C ANSLIST=[n]*(n+1) [n]*(n+1) ANSLIST
n,m=map(int,input().split())
C=set(map(int,input().split()))

ANSLIST=[n]*(n+1)

ANSLIST[0]=0

for i in range(1,n+1):
    ANSLIST[i]=min([ANSLIST[i-c]+1  for c in C if i-c>=0])

print(ANSLIST[n])
