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

memo=[n+1 for _ in range(n+1)]
memo[n]=0

for i in range(n,-1,-1):
    for xx in x:
        if i-xx<0:
            continue
        memo[i-xx]=min(memo[i-xx],memo[i]+1)
print(memo[0]) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m x=list(map(int,input().split())) x list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split n+1 for _ in range(n+1) for _ in range(n+1) _ range(n+1) range n+1 n 1 for _ in range(n+1) n+1 n 1 memo=[n+1 for _ in range(n+1)] memo [n+1 for _ in range(n+1)] memo[n]=0 memo[n] memo n 0 for i in range(n,-1,-1):
    for xx in x:
        if i-xx<0:
            continue
        memo[i-xx]=min(memo[i-xx],memo[i]+1) i range(n,-1,-1) range n -1 -1 for xx in x:
        if i-xx<0:
            continue
        memo[i-xx]=min(memo[i-xx],memo[i]+1) xx x if i-xx<0:
            continue
         i-xx<0 i-xx i xx 0 continue memo[i-xx]=min(memo[i-xx],memo[i]+1) memo[i-xx] memo i-xx i xx min(memo[i-xx],memo[i]+1) min memo[i-xx] memo i-xx i xx memo[i]+1 memo[i] memo i 1 print(memo[0]) print memo[0] memo 0 n,m=map(int,input().split()) map(int,input().split()) n memo=[n+1 for _ in range(n+1)] [n+1 for _ in range(n+1)] memo x=list(map(int,input().split())) list(map(int,input().split())) x m=map(int,input().split()) map(int,input().split()) m
n,m=map(int,input().split())
x=list(map(int,input().split()))

memo=[n+1 for _ in range(n+1)]
memo[n]=0

for i in range(n,-1,-1):
    for xx in x:
        if i-xx<0:
            continue
        memo[i-xx]=min(memo[i-xx],memo[i]+1)
print(memo[0])
