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

INF = 10**10
dp = [INF]*(n+1)
dp[0] = 0

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

print(dp[n]) n, m =map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m c = list(map(int,input().split())) c list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split INF = 10**10 INF 10**10 10 10 dp = [INF]*(n+1) dp [INF]*(n+1) [INF] INF n+1 n 1 dp[0] = 0 dp[0] dp 0 0 for i in range (n+1):
    for j in range (len(c)):
        if i-c[j]>=0:
            dp[i] = min(dp[i],dp[i-c[j]]+1) i range (n+1) range n+1 n 1 for j in range (len(c)):
        if i-c[j]>=0:
            dp[i] = min(dp[i],dp[i-c[j]]+1) j range (len(c)) range len(c) len c if i-c[j]>=0:
            dp[i] = min(dp[i],dp[i-c[j]]+1) i-c[j]>=0 i-c[j] i c[j] c j 0 dp[i] = min(dp[i],dp[i-c[j]]+1) dp[i] dp i min(dp[i],dp[i-c[j]]+1) min dp[i] dp i dp[i-c[j]]+1 dp[i-c[j]] dp i-c[j] i c[j] c j 1 print(dp[n]) print dp[n] dp n n, m =map(int,input().split()) map(int,input().split()) n c = list(map(int,input().split())) list(map(int,input().split())) c dp = [INF]*(n+1) [INF]*(n+1) dp m =map(int,input().split()) map(int,input().split()) m INF = 10**10 10**10 INF
n, m =map(int,input().split())
c = list(map(int,input().split()))

INF = 10**10
dp = [INF]*(n+1)
dp[0] = 0

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

print(dp[n])
