n, m = map(int, input().split())
c = sorted(list(map(int, input().split())))
dp = [[0]*(n+1) for _ in range(m)]

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

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