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

INF = 10**100
dp = [INF]*500000
dp[0] = 0

for i in range (n+1):
    for j in c:
        dp[i+j] = min(dp[i+j],dp[i]+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**100 INF 10**100 10 100 dp = [INF]*500000 dp [INF]*500000 [INF] INF 500000 dp[0] = 0 dp[0] dp 0 0 for i in range (n+1):
    for j in c:
        dp[i+j] = min(dp[i+j],dp[i]+1) i range (n+1) range n+1 n 1 for j in c:
        dp[i+j] = min(dp[i+j],dp[i]+1) j c dp[i+j] = min(dp[i+j],dp[i]+1) dp[i+j] dp i+j i j min(dp[i+j],dp[i]+1) min dp[i+j] dp i+j i j dp[i]+1 dp[i] dp i 1 print(dp[n]) print dp[n] dp n c = list(map(int,input().split())) list(map(int,input().split())) c n, m =map(int,input().split()) map(int,input().split()) n m =map(int,input().split()) map(int,input().split()) m INF = 10**100 10**100 INF dp = [INF]*500000 [INF]*500000 dp
n, m =map(int,input().split())
c = list(map(int,input().split()))

INF = 10**100
dp = [INF]*500000
dp[0] = 0

for i in range (n+1):
    for j in c:
        dp[i+j] = min(dp[i+j],dp[i]+1)
print(dp[n])
