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