N, M = map(int, input().split())
A = list(map(int, input().split()))

dp = [[1<<60]*(N+1) for _ in range(M+1)]
dp[0][0] = 0

for i in range(M):
    for j in range(N+1):
        if A[i] <= j:
            dp[i+1][j] = min(dp[i][j], dp[i+1][j-A[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 A = list(map(int, input().split())) A list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split [1<<60]*(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) [1<<60]*(N+1) [1<<60] 1<<60 1 60 N+1 N 1 dp = [[1<<60]*(N+1) for _ in range(M+1)] dp [[1<<60]*(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 A[i] <= j:
            dp[i+1][j] = min(dp[i][j], dp[i+1][j-A[i]] + 1)
        else:
            dp[i + 1][j] = dp[i][j] i range(M) range M for j in range(N+1):
        if A[i] <= j:
            dp[i+1][j] = min(dp[i][j], dp[i+1][j-A[i]] + 1)
        else:
            dp[i + 1][j] = dp[i][j] j range(N+1) range N+1 N 1 if A[i] <= j:
            dp[i+1][j] = min(dp[i][j], dp[i+1][j-A[i]] + 1)
        else:
            dp[i + 1][j] = dp[i][j] A[i] <= j A[i] A i j dp[i+1][j] = min(dp[i][j], dp[i+1][j-A[i]] + 1) dp[i+1][j] [i+1] dp i+1 i 1 j min(dp[i][j], dp[i+1][j-A[i]] + 1) min dp[i][j] [i] dp i j dp[i+1][j-A[i]] + 1 dp[i+1][j-A[i]] [i+1] dp i+1 i 1 j-A[i] j A[i] A 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 dp = [[1<<60]*(N+1) for _ in range(M+1)] [[1<<60]*(N+1) for _ in range(M+1)] dp A = list(map(int, input().split())) list(map(int, input().split())) A
N, M = map(int, input().split())
A = list(map(int, input().split()))

dp = [[1<<60]*(N+1) for _ in range(M+1)]
dp[0][0] = 0

for i in range(M):
    for j in range(N+1):
        if A[i] <= j:
            dp[i+1][j] = min(dp[i][j], dp[i+1][j-A[i]] + 1)
        else:
            dp[i + 1][j] = dp[i][j]
print(dp[M][N])
