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

DP = [[100000 for _ in range(n+1)] for _ in range(m+1)]
DP[0][0] = 0

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

print(DP[m][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 [100000 for _ in range(n+1)] for _ in range(m+1) for _ in range(m+1) _ range(m+1) range m+1 m 1 for _ in range(m+1) [100000 for _ in range(n+1)] DP = [[100000 for _ in range(n+1)] for _ in range(m+1)] DP [[100000 for _ in range(n+1)] for _ in range(m+1)] DP[0][0] = 0 DP[0][0] [0] DP 0 0 0 for i in range(m):
    for j in range(n+1):
        if(j >= c[i]):
            DP[i+1][j] = min(DP[i][j], DP[i+1][j-c[i]]+1)
        else:
            DP[i+1][j] = DP[i][j] i range(m) range m for j in range(n+1):
        if(j >= c[i]):
            DP[i+1][j] = min(DP[i][j], DP[i+1][j-c[i]]+1)
        else:
            DP[i+1][j] = DP[i][j] j range(n+1) range n+1 n 1 if(j >= c[i]):
            DP[i+1][j] = min(DP[i][j], DP[i+1][j-c[i]]+1)
        else:
            DP[i+1][j] = DP[i][j] j >= c[i] j c[i] c i DP[i+1][j] = min(DP[i][j], DP[i+1][j-c[i]]+1) DP[i+1][j] [i+1] DP i+1 i 1 j min(DP[i][j], DP[i+1][j-c[i]]+1) min DP[i][j] [i] DP i j DP[i+1][j-c[i]]+1 DP[i+1][j-c[i]] [i+1] DP i+1 i 1 j-c[i] j c[i] c i 1 DP[i+1][j] = DP[i][j] DP[i+1][j] [i+1] DP i+1 i 1 j DP[i][j] [i] DP i j print(DP[m][n]) print DP[m][n] [m] DP m 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 = [[100000 for _ in range(n+1)] for _ in range(m+1)] [[100000 for _ in range(n+1)] for _ in range(m+1)] DP
n, m = map(int, input().split())
c = list(map(int, input().split()))

DP = [[100000 for _ in range(n+1)] for _ in range(m+1)]
DP[0][0] = 0

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

print(DP[m][n])
