N, M = map(int, input().split(' '))
coins = tuple(map(int, input().split(' ')))

dp = [N + 1] * (N + 1)
dp[0] = 0

for i in range(N + 1):
    for coin in coins:
        if coin <= i:
            dp[i] = min(dp[i], dp[i - coin] + 1)

print(dp[N])
 N, M = map(int, input().split(' ')) N map(int, input().split(' ')) map int input().split(' ') ().split () input split ' ' M coins = tuple(map(int, input().split(' '))) coins tuple(map(int, input().split(' '))) tuple map(int, input().split(' ')) map int input().split(' ') ().split () input split ' ' dp = [N + 1] * (N + 1) dp [N + 1] * (N + 1) [N + 1] N + 1 N 1 N + 1 N 1 dp[0] = 0 dp[0] dp 0 0 for i in range(N + 1):
    for coin in coins:
        if coin <= i:
            dp[i] = min(dp[i], dp[i - coin] + 1) i range(N + 1) range N + 1 N 1 for coin in coins:
        if coin <= i:
            dp[i] = min(dp[i], dp[i - coin] + 1) coin coins if coin <= i:
            dp[i] = min(dp[i], dp[i - coin] + 1) coin <= i coin i dp[i] = min(dp[i], dp[i - coin] + 1) dp[i] dp i min(dp[i], dp[i - coin] + 1) min dp[i] dp i dp[i - coin] + 1 dp[i - coin] dp i - coin i coin 1 print(dp[N]) print dp[N] dp N coins = tuple(map(int, input().split(' '))) tuple(map(int, input().split(' '))) coins N, M = map(int, input().split(' ')) map(int, input().split(' ')) N M = map(int, input().split(' ')) map(int, input().split(' ')) M dp = [N + 1] * (N + 1) [N + 1] * (N + 1) dp
N, M = map(int, input().split(' '))
coins = tuple(map(int, input().split(' ')))

dp = [N + 1] * (N + 1)
dp[0] = 0

for i in range(N + 1):
    for coin in coins:
        if coin <= i:
            dp[i] = min(dp[i], dp[i - coin] + 1)

print(dp[N])

