n, m = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
d = {0:0}
for i in range(1, n + 1):
    min_ = n + 1
    for j in C:
        if i - j in d:
            tmp = d[i - j] + 1
            if tmp < min_:
                min_ = tmp
    d[i] = min_
print(d[n]) int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i n, m = [int(i) for i in input().split()] n [int(i) for i in input().split()] m int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i C = [int(i) for i in input().split()] C [int(i) for i in input().split()] d = {0:0} d {0:0} 0 0 0 for i in range(1, n + 1):
    min_ = n + 1
    for j in C:
        if i - j in d:
            tmp = d[i - j] + 1
            if tmp < min_:
                min_ = tmp
    d[i] = min_ i range(1, n + 1) range 1 n + 1 n 1 min_ = n + 1 min_ n + 1 n 1 for j in C:
        if i - j in d:
            tmp = d[i - j] + 1
            if tmp < min_:
                min_ = tmp
     j C if i - j in d:
            tmp = d[i - j] + 1
            if tmp < min_:
                min_ = tmp
     i - j in d i - j i j d tmp = d[i - j] + 1 tmp d[i - j] + 1 d[i - j] d i - j i j 1 if tmp < min_:
                min_ = tmp
     tmp < min_ tmp min_ min_ = tmp min_ tmp d[i] = min_ d[i] d i min_ print(d[n]) print d[n] d n C = [int(i) for i in input().split()] [int(i) for i in input().split()] C tmp = d[i - j] + 1 d[i - j] + 1 tmp d = {0:0} {0:0} d n, m = [int(i) for i in input().split()] [int(i) for i in input().split()] n min_ = tmp tmp min_ min_ = n + 1 n + 1 min_ m = [int(i) for i in input().split()] [int(i) for i in input().split()] m
n, m = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
d = {0:0}
for i in range(1, n + 1):
    min_ = n + 1
    for j in C:
        if i - j in d:
            tmp = d[i - j] + 1
            if tmp < min_:
                min_ = tmp
    d[i] = min_
print(d[n])
