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

dp = [float('inf') for _ in range(n+1)]
dp[0] = 0

for i in range(n):
    for money in a:
        next_money = i + money
        if next_money > n:
            continue
        dp[next_money] = min(dp[i] + 1, dp[next_money])

print(dp[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 float('inf') for _ in range(n+1) for _ in range(n+1) _ range(n+1) range n+1 n 1 for _ in range(n+1) float('inf') float 'inf' dp = [float('inf') for _ in range(n+1)] dp [float('inf') for _ in range(n+1)] dp[0] = 0 dp[0] dp 0 0 for i in range(n):
    for money in a:
        next_money = i + money
        if next_money > n:
            continue
        dp[next_money] = min(dp[i] + 1, dp[next_money]) i range(n) range n for money in a:
        next_money = i + money
        if next_money > n:
            continue
        dp[next_money] = min(dp[i] + 1, dp[next_money]) money a next_money = i + money next_money i + money i money if next_money > n:
            continue
         next_money > n next_money n continue dp[next_money] = min(dp[i] + 1, dp[next_money]) dp[next_money] dp next_money min(dp[i] + 1, dp[next_money]) min dp[i] + 1 dp[i] dp i 1 dp[next_money] dp next_money print(dp[n]) print dp[n] dp n dp = [float('inf') for _ in range(n+1)] [float('inf') for _ in range(n+1)] dp m = map(int, input().split()) map(int, input().split()) m a = list(map(int, input().split())) list(map(int, input().split())) a next_money = i + money i + money next_money n, m = map(int, input().split()) map(int, input().split()) n
n, m = map(int, input().split())
a = list(map(int, input().split()))

dp = [float('inf') for _ in range(n+1)]
dp[0] = 0

for i in range(n):
    for money in a:
        next_money = i + money
        if next_money > n:
            continue
        dp[next_money] = min(dp[i] + 1, dp[next_money])

print(dp[n])
