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

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

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

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

for i in range(n):
    for j in c:
        dp[i + j] = min(dp[i + j], dp[i] + 1)

print(dp[n])
