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

currency = sorted(map(int,input().split()))

gra = [float('inf')]*(n+1)
gra[0] = 0
for i in range(m):
    for j in range(currency[i],n+1):
        gra[j] = min(gra[j],gra[j-currency[i]]+1)

print(gra[n]) n,m = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m currency = sorted(map(int,input().split())) currency sorted(map(int,input().split())) sorted map(int,input().split()) map int input().split() ().split () input split gra = [float('inf')]*(n+1) gra [float('inf')]*(n+1) [float('inf')] float('inf') float 'inf' n+1 n 1 gra[0] = 0 gra[0] gra 0 0 for i in range(m):
    for j in range(currency[i],n+1):
        gra[j] = min(gra[j],gra[j-currency[i]]+1) i range(m) range m for j in range(currency[i],n+1):
        gra[j] = min(gra[j],gra[j-currency[i]]+1) j range(currency[i],n+1) range currency[i] currency i n+1 n 1 gra[j] = min(gra[j],gra[j-currency[i]]+1) gra[j] gra j min(gra[j],gra[j-currency[i]]+1) min gra[j] gra j gra[j-currency[i]]+1 gra[j-currency[i]] gra j-currency[i] j currency[i] currency i 1 print(gra[n]) print gra[n] gra n m = map(int,input().split()) map(int,input().split()) m n,m = map(int,input().split()) map(int,input().split()) n currency = sorted(map(int,input().split())) sorted(map(int,input().split())) currency gra = [float('inf')]*(n+1) [float('inf')]*(n+1) gra
n,m = map(int,input().split())

currency = sorted(map(int,input().split()))

gra = [float('inf')]*(n+1)
gra[0] = 0
for i in range(m):
    for j in range(currency[i],n+1):
        gra[j] = min(gra[j],gra[j-currency[i]]+1)

print(gra[n])