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