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

dp=[i for i in range(n+1)]

c.remove(1)
c.sort()

for coin in c:
	for x in range(1,n+1):
		if x-coin>=0:
			dp[x]=min(dp[x],dp[x-coin]+1)

print dp[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 i for i in range(n+1) for i in range(n+1) i range(n+1) range n+1 n 1 for i in range(n+1) i dp=[i for i in range(n+1)] dp [i for i in range(n+1)] c.remove(1) c.remove c remove 1 c.sort() c.sort c sort for coin in c:
	for x in range(1,n+1):
		if x-coin>=0:
			dp[x]=min(dp[x],dp[x-coin]+1) coin c for x in range(1,n+1):
		if x-coin>=0:
			dp[x]=min(dp[x],dp[x-coin]+1) x range(1,n+1) range 1 n+1 n 1 if x-coin>=0:
			dp[x]=min(dp[x],dp[x-coin]+1) x-coin>=0 x-coin x coin 0 dp[x]=min(dp[x],dp[x-coin]+1) dp[x] dp x min(dp[x],dp[x-coin]+1) min dp[x] dp x dp[x-coin]+1 dp[x-coin] dp x-coin x coin 1 print dp[n] dp n dp=[i for i in range(n+1)] [i for i in range(n+1)] dp n,m=map(int,raw_input().split()) map(int,raw_input().split()) n c=map(int,raw_input().split()) map(int,raw_input().split()) c m=map(int,raw_input().split()) map(int,raw_input().split()) m
n,m=map(int,raw_input().split())
c=map(int,raw_input().split())

dp=[i for i in range(n+1)]

c.remove(1)
c.sort()

for coin in c:
	for x in range(1,n+1):
		if x-coin>=0:
			dp[x]=min(dp[x],dp[x-coin]+1)

print dp[n]
