
n, m = list(map(int, input().split(" ")))
c = list(map(int, input().split(" ")))
dp = [10**5 for i in range(n + 1)]
dp[0] = 0

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

n, m = list(map(int, input().split(" ")))
c = list(map(int, input().split(" ")))
dp = [10**5 for i in range(n + 1)]
dp[0] = 0

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

