N, M = map(int, input().split())
C = [int(x) for x in input().split()]
C.sort()
A = [0 for _ in range(N + 1)]
for c in C:
    if c > N:
        break
    A[c] = 1
for i in range(1, N + 1):
    pos = []
    for c in C:
        if i - c < 0:
            break
        pos.append(A[i - c])
    A[i] = min(pos) + 1
print(A[-1])
 N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x C = [int(x) for x in input().split()] C [int(x) for x in input().split()] C.sort() C.sort C sort 0 for _ in range(N + 1) for _ in range(N + 1) _ range(N + 1) range N + 1 N 1 for _ in range(N + 1) 0 A = [0 for _ in range(N + 1)] A [0 for _ in range(N + 1)] for c in C:
    if c > N:
        break
    A[c] = 1 c C if c > N:
        break
     c > N c N break A[c] = 1 A[c] A c 1 for i in range(1, N + 1):
    pos = []
    for c in C:
        if i - c < 0:
            break
        pos.append(A[i - c])
    A[i] = min(pos) + 1 i range(1, N + 1) range 1 N + 1 N 1 pos = [] pos [] for c in C:
        if i - c < 0:
            break
        pos.append(A[i - c])
     c C if i - c < 0:
            break
         i - c < 0 i - c i c 0 break pos.append(A[i - c]) pos.append pos append A[i - c] A i - c i c A[i] = min(pos) + 1 A[i] A i min(pos) + 1 min(pos) min pos 1 print(A[-1]) print A[-1] A -1 M = map(int, input().split()) map(int, input().split()) M pos = [] [] pos C = [int(x) for x in input().split()] [int(x) for x in input().split()] C N, M = map(int, input().split()) map(int, input().split()) N A = [0 for _ in range(N + 1)] [0 for _ in range(N + 1)] A
N, M = map(int, input().split())
C = [int(x) for x in input().split()]
C.sort()
A = [0 for _ in range(N + 1)]
for c in C:
    if c > N:
        break
    A[c] = 1
for i in range(1, N + 1):
    pos = []
    for c in C:
        if i - c < 0:
            break
        pos.append(A[i - c])
    A[i] = min(pos) + 1
print(A[-1])

