# -*- coding: utf-8 -*-

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

f = dict() #k?????§??????????????????????°??????????????????¨?????°
f[0] = 0
for k in range(1,n+1):
    f[k] = float('inf')
    for c in cs:
        if k - c < 0:
            continue
        f[k] = min(f[k], f[k - c] + 1)

print(f[n]) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m cs = list(map(int, input().split())) cs list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split f = dict() f dict() dict f[0] = 0 f[0] f 0 0 for k in range(1,n+1):
    f[k] = float('inf')
    for c in cs:
        if k - c < 0:
            continue
        f[k] = min(f[k], f[k - c] + 1) k range(1,n+1) range 1 n+1 n 1 f[k] = float('inf') f[k] f k float('inf') float 'inf' for c in cs:
        if k - c < 0:
            continue
        f[k] = min(f[k], f[k - c] + 1) c cs if k - c < 0:
            continue
         k - c < 0 k - c k c 0 continue f[k] = min(f[k], f[k - c] + 1) f[k] f k min(f[k], f[k - c] + 1) min f[k] f k f[k - c] + 1 f[k - c] f k - c k c 1 print(f[n]) print f[n] f n n, m = map(int, input().split()) map(int, input().split()) n cs = list(map(int, input().split())) list(map(int, input().split())) cs f = dict() dict() f m = map(int, input().split()) map(int, input().split()) m
# -*- coding: utf-8 -*-

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

f = dict() #k?????§??????????????????????°??????????????????¨?????°
f[0] = 0
for k in range(1,n+1):
    f[k] = float('inf')
    for c in cs:
        if k - c < 0:
            continue
        f[k] = min(f[k], f[k - c] + 1)

print(f[n])