n, m = list(map(int, input().split()))
coin = list(map(int, input().split()))
a = [i for i in range(n + 1)]
for j in coin:
    for i in range(j, n + 1):
        a[i] = min(a[i], a[i - j] + 1)

print(a[n])
 n, m = list(map(int, input().split())) n list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split m coin = list(map(int, input().split())) coin list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split i for i in range(n + 1) for i in range(n + 1) i range(n + 1) range n + 1 n 1 for i in range(n + 1) i a = [i for i in range(n + 1)] a [i for i in range(n + 1)] for j in coin:
    for i in range(j, n + 1):
        a[i] = min(a[i], a[i - j] + 1) j coin for i in range(j, n + 1):
        a[i] = min(a[i], a[i - j] + 1) i range(j, n + 1) range j n + 1 n 1 a[i] = min(a[i], a[i - j] + 1) a[i] a i min(a[i], a[i - j] + 1) min a[i] a i a[i - j] + 1 a[i - j] a i - j i j 1 print(a[n]) print a[n] a n m = list(map(int, input().split())) list(map(int, input().split())) m coin = list(map(int, input().split())) list(map(int, input().split())) coin a = [i for i in range(n + 1)] [i for i in range(n + 1)] a n, m = list(map(int, input().split())) list(map(int, input().split())) n
n, m = list(map(int, input().split()))
coin = list(map(int, input().split()))
a = [i for i in range(n + 1)]
for j in coin:
    for i in range(j, n + 1):
        a[i] = min(a[i], a[i - j] + 1)

print(a[n])

