INF = 10**8

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

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

for coin in c:
	for price in range(coin, n + 1):
		d[price] = min(d[price], d[price - coin] + 1)

print(d[n]) INF = 10**8 INF 10**8 10 8 n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m c = list(map(int, input().split())) c list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split d = [INF] * (n + 1) d [INF] * (n + 1) [INF] INF n + 1 n 1 d[0] = 0 d[0] d 0 0 for coin in c:
	for price in range(coin, n + 1):
		d[price] = min(d[price], d[price - coin] + 1) coin c for price in range(coin, n + 1):
		d[price] = min(d[price], d[price - coin] + 1) price range(coin, n + 1) range coin n + 1 n 1 d[price] = min(d[price], d[price - coin] + 1) d[price] d price min(d[price], d[price - coin] + 1) min d[price] d price d[price - coin] + 1 d[price - coin] d price - coin price coin 1 print(d[n]) print d[n] d n c = list(map(int, input().split())) list(map(int, input().split())) c n, m = map(int, input().split()) map(int, input().split()) n INF = 10**8 10**8 INF m = map(int, input().split()) map(int, input().split()) m d = [INF] * (n + 1) [INF] * (n + 1) d
INF = 10**8

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

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

for coin in c:
	for price in range(coin, n + 1):
		d[price] = min(d[price], d[price - coin] + 1)

print(d[n])
