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