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

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

dp=[float('inf')]*(n+1)
dp[0]=0
for i in range(n+1):
    if dp[i]==float('inf'):continue
    for j in c:
        if i+j>n:continue
        dp[i+j]=min(dp[i]+1,dp[i+j])
print(dp[-1])
