n, m = map(int, raw_input().split())
c = map(int, raw_input().split())

INF = 1000000000

t = [INF] * (n + 1)
t[0] = 0

for i in range(m):
    for j in range(c[i], n + 1):
        t[j] = min([t[j], t[j - c[i]] + 1])

print(t[n]) n, m = map(int, raw_input().split()) n map(int, raw_input().split()) map int raw_input().split() ().split () raw_input split m c = map(int, raw_input().split()) c map(int, raw_input().split()) map int raw_input().split() ().split () raw_input split INF = 1000000000 INF 1000000000 t = [INF] * (n + 1) t [INF] * (n + 1) [INF] INF n + 1 n 1 t[0] = 0 t[0] t 0 0 for i in range(m):
    for j in range(c[i], n + 1):
        t[j] = min([t[j], t[j - c[i]] + 1]) i range(m) range m for j in range(c[i], n + 1):
        t[j] = min([t[j], t[j - c[i]] + 1]) j range(c[i], n + 1) range c[i] c i n + 1 n 1 t[j] = min([t[j], t[j - c[i]] + 1]) t[j] t j min([t[j], t[j - c[i]] + 1]) min [t[j], t[j - c[i]] + 1] t[j] t j t[j - c[i]] + 1 t[j - c[i]] t j - c[i] j c[i] c i 1 print(t[n]) print t[n] t n n, m = map(int, raw_input().split()) map(int, raw_input().split()) n m = map(int, raw_input().split()) map(int, raw_input().split()) m t = [INF] * (n + 1) [INF] * (n + 1) t INF = 1000000000 1000000000 INF c = map(int, raw_input().split()) map(int, raw_input().split()) c
n, m = map(int, raw_input().split())
c = map(int, raw_input().split())

INF = 1000000000

t = [INF] * (n + 1)
t[0] = 0

for i in range(m):
    for j in range(c[i], n + 1):
        t[j] = min([t[j], t[j - c[i]] + 1])

print(t[n])