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

