a,b = [int(i) for i in input().split()]
l =  [int(i) for i in input().split()]
ans = [10**9 for _ in range(a+1)]       
ans[0] = 0          

for i in range(a+1):
    for j in l:
        if i + j < a+1:
            ans[i+j] = min(ans[i] + 1,ans[i+j])
            
print(ans[-1]) int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i a,b = [int(i) for i in input().split()] a [int(i) for i in input().split()] b int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i l =  [int(i) for i in input().split()] l [int(i) for i in input().split()] 10**9 for _ in range(a+1) for _ in range(a+1) _ range(a+1) range a+1 a 1 for _ in range(a+1) 10**9 10 9 ans = [10**9 for _ in range(a+1)] ans [10**9 for _ in range(a+1)] ans[0] = 0 ans[0] ans 0 0 for i in range(a+1):
    for j in l:
        if i + j < a+1:
            ans[i+j] = min(ans[i] + 1,ans[i+j])
             i range(a+1) range a+1 a 1 for j in l:
        if i + j < a+1:
            ans[i+j] = min(ans[i] + 1,ans[i+j])
             j l if i + j < a+1:
            ans[i+j] = min(ans[i] + 1,ans[i+j])
             i + j < a+1 i + j i j a+1 a 1 ans[i+j] = min(ans[i] + 1,ans[i+j]) ans[i+j] ans i+j i j min(ans[i] + 1,ans[i+j]) min ans[i] + 1 ans[i] ans i 1 ans[i+j] ans i+j i j print(ans[-1]) print ans[-1] ans -1 ans = [10**9 for _ in range(a+1)] [10**9 for _ in range(a+1)] ans l =  [int(i) for i in input().split()] [int(i) for i in input().split()] l b = [int(i) for i in input().split()] [int(i) for i in input().split()] b a,b = [int(i) for i in input().split()] [int(i) for i in input().split()] a
a,b = [int(i) for i in input().split()]
l =  [int(i) for i in input().split()]
ans = [10**9 for _ in range(a+1)]       
ans[0] = 0          

for i in range(a+1):
    for j in l:
        if i + j < a+1:
            ans[i+j] = min(ans[i] + 1,ans[i+j])
            
print(ans[-1])
