n, m = map(int, input().split())
c = list(map(int, input().split()))
INF = float("inf")

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

for i in range(m):
    for j in range(n+1):
        if j + c[i] > n:
            break
        else:
            dp[j + c[i]] = min(dp[j + c[i]], dp[j] + 1)

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

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

for i in range(m):
    for j in range(n+1):
        if j + c[i] > n:
            break
        else:
            dp[j + c[i]] = min(dp[j + c[i]], dp[j] + 1)

print(dp[n])
