def f(num):
    mn = 20000
    for y in c:
        if y > num/2:
            break
        mn = min(mn, yen[y]+yen[num-y])
    return mn

n, m = map(int, input().split())
c = list(map(int, input().split()))
c = sorted(c)
yen = [0 for i in range(n+1)]
yen[1] = 1
for num in range(2, n+1):
    if num in c:
        yen[num] = 1
    else:
        yen[num] = min(yen[num-1]+1,f(num))

print(yen[n]) def f(num):
    mn = 20000
    for y in c:
        if y > num/2:
            break
        mn = min(mn, yen[y]+yen[num-y])
    return mn f mn = 20000 mn 20000 for y in c:
        if y > num/2:
            break
        mn = min(mn, yen[y]+yen[num-y])
     y c if y > num/2:
            break
         y > num/2 y num/2 num 2 break mn = min(mn, yen[y]+yen[num-y]) mn min(mn, yen[y]+yen[num-y]) min mn yen[y]+yen[num-y] yen[y] yen y yen[num-y] yen num-y num y return mn mn num num 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 c = sorted(c) c sorted(c) sorted c 0 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) 0 yen = [0 for i in range(n+1)] yen [0 for i in range(n+1)] yen[1] = 1 yen[1] yen 1 1 for num in range(2, n+1):
    if num in c:
        yen[num] = 1
    else:
        yen[num] = min(yen[num-1]+1,f(num)) num range(2, n+1) range 2 n+1 n 1 if num in c:
        yen[num] = 1
    else:
        yen[num] = min(yen[num-1]+1,f(num)) num in c num c yen[num] = 1 yen[num] yen num 1 yen[num] = min(yen[num-1]+1,f(num)) yen[num] yen num min(yen[num-1]+1,f(num)) min yen[num-1]+1 yen[num-1] yen num-1 num 1 1 f(num) f num print(yen[n]) print yen[n] yen n yen = [0 for i in range(n+1)] [0 for i in range(n+1)] yen n, m = map(int, input().split()) map(int, input().split()) n def f(num):
    mn = 20000
    for y in c:
        if y > num/2:
            break
        mn = min(mn, yen[y]+yen[num-y])
    return mn def f(num):
    mn = 20000
    for y in c:
        if y > num/2:
            break
        mn = min(mn, yen[y]+yen[num-y])
    return mn f c = list(map(int, input().split())) list(map(int, input().split())) c m = map(int, input().split()) map(int, input().split()) m c = sorted(c) sorted(c) c
def f(num):
    mn = 20000
    for y in c:
        if y > num/2:
            break
        mn = min(mn, yen[y]+yen[num-y])
    return mn

n, m = map(int, input().split())
c = list(map(int, input().split()))
c = sorted(c)
yen = [0 for i in range(n+1)]
yen[1] = 1
for num in range(2, n+1):
    if num in c:
        yen[num] = 1
    else:
        yen[num] = min(yen[num-1]+1,f(num))

print(yen[n])
