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

