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