N, M = map(int, input().split())
Coins = list(map(int, input().split()))

DP = [10 ** 9 for _ in range(N + 1)]
DP[0] = 0

for i in range(N):
    for c in Coins:
        if i + c <= N:
            DP[i + c] = min(DP[i + c], DP[i] + 1)

print(DP[N])
 N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M Coins = list(map(int, input().split())) Coins list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split 10 ** 9 for _ in range(N + 1) for _ in range(N + 1) _ range(N + 1) range N + 1 N 1 for _ in range(N + 1) 10 ** 9 10 9 DP = [10 ** 9 for _ in range(N + 1)] DP [10 ** 9 for _ in range(N + 1)] DP[0] = 0 DP[0] DP 0 0 for i in range(N):
    for c in Coins:
        if i + c <= N:
            DP[i + c] = min(DP[i + c], DP[i] + 1) i range(N) range N for c in Coins:
        if i + c <= N:
            DP[i + c] = min(DP[i + c], DP[i] + 1) c Coins if i + c <= N:
            DP[i + c] = min(DP[i + c], DP[i] + 1) i + c <= N i + c i c N DP[i + c] = min(DP[i + c], DP[i] + 1) DP[i + c] DP i + c i c min(DP[i + c], DP[i] + 1) min DP[i + c] DP i + c i c DP[i] + 1 DP[i] DP i 1 print(DP[N]) print DP[N] DP N M = map(int, input().split()) map(int, input().split()) M Coins = list(map(int, input().split())) list(map(int, input().split())) Coins N, M = map(int, input().split()) map(int, input().split()) N DP = [10 ** 9 for _ in range(N + 1)] [10 ** 9 for _ in range(N + 1)] DP
N, M = map(int, input().split())
Coins = list(map(int, input().split()))

DP = [10 ** 9 for _ in range(N + 1)]
DP[0] = 0

for i in range(N):
    for c in Coins:
        if i + c <= N:
            DP[i + c] = min(DP[i + c], DP[i] + 1)

print(DP[N])

