n,m = map(int, input().split())
d = list(map(int, input().split()))
inf = float('inf')
dp = [inf for i in range(n+1)]
dp[0] = 0
for i in range(m):
    for j in range(d[i], n+1):
        dp[j] = min(dp[j], dp[j-d[i]]+1)

print(dp[-1]) n,m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m d = list(map(int, input().split())) d list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split inf = float('inf') inf float('inf') float 'inf' inf 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) inf dp = [inf for i in range(n+1)] dp [inf for i in range(n+1)] dp[0] = 0 dp[0] dp 0 0 for i in range(m):
    for j in range(d[i], n+1):
        dp[j] = min(dp[j], dp[j-d[i]]+1) i range(m) range m for j in range(d[i], n+1):
        dp[j] = min(dp[j], dp[j-d[i]]+1) j range(d[i], n+1) range d[i] d i n+1 n 1 dp[j] = min(dp[j], dp[j-d[i]]+1) dp[j] dp j min(dp[j], dp[j-d[i]]+1) min dp[j] dp j dp[j-d[i]]+1 dp[j-d[i]] dp j-d[i] j d[i] d i 1 print(dp[-1]) print dp[-1] dp -1 m = map(int, input().split()) map(int, input().split()) m dp = [inf for i in range(n+1)] [inf for i in range(n+1)] dp n,m = map(int, input().split()) map(int, input().split()) n inf = float('inf') float('inf') inf d = list(map(int, input().split())) list(map(int, input().split())) d
n,m = map(int, input().split())
d = list(map(int, input().split()))
inf = float('inf')
dp = [inf for i in range(n+1)]
dp[0] = 0
for i in range(m):
    for j in range(d[i], n+1):
        dp[j] = min(dp[j], dp[j-d[i]]+1)

print(dp[-1])
