n,m,*L=map(int,open(0).read().split())
dp=list(range(n+1))
for c in L:
	for j in range(c,n+1):
		dp[j]=min(dp[j],dp[j-c]+1)
print(dp[n]) n,m,*L=map(int,open(0).read().split()) n map(int,open(0).read().split()) map int open(0).read().split() (0).read().split (0).read() (0).read (0) open 0 read split m *L L dp=list(range(n+1)) dp list(range(n+1)) list range(n+1) range n+1 n 1 for c in L:
	for j in range(c,n+1):
		dp[j]=min(dp[j],dp[j-c]+1) c L for j in range(c,n+1):
		dp[j]=min(dp[j],dp[j-c]+1) j range(c,n+1) range c n+1 n 1 dp[j]=min(dp[j],dp[j-c]+1) dp[j] dp j min(dp[j],dp[j-c]+1) min dp[j] dp j dp[j-c]+1 dp[j-c] dp j-c j c 1 print(dp[n]) print dp[n] dp n dp=list(range(n+1)) list(range(n+1)) dp n,m,*L=map(int,open(0).read().split()) map(int,open(0).read().split()) n m,*L=map(int,open(0).read().split()) map(int,open(0).read().split()) m
n,m,*L=map(int,open(0).read().split())
dp=list(range(n+1))
for c in L:
	for j in range(c,n+1):
		dp[j]=min(dp[j],dp[j-c]+1)
print(dp[n])
