n, m = [int(x) for x in raw_input().split()]
c = [int(x) for x in raw_input().split()]

INF = float("inf")
dp = [INF for i in xrange(n + 1)]
dp[0] = 0
for i in xrange(1, n + 1):
    for j in xrange(m):
        if c[j] <= i:
            dp[i] = min(dp[i], dp[i - c[j]] + 1)

print dp[n] int(x) for x in raw_input().split() for x in raw_input().split() x raw_input().split() ().split () raw_input split for x in raw_input().split() int(x) int x n, m = [int(x) for x in raw_input().split()] n [int(x) for x in raw_input().split()] m int(x) for x in raw_input().split() for x in raw_input().split() x raw_input().split() ().split () raw_input split for x in raw_input().split() int(x) int x c = [int(x) for x in raw_input().split()] c [int(x) for x in raw_input().split()] INF = float("inf") INF float("inf") float "inf" INF for i in xrange(n + 1) for i in xrange(n + 1) i xrange(n + 1) xrange n + 1 n 1 for i in xrange(n + 1) INF dp = [INF for i in xrange(n + 1)] dp [INF for i in xrange(n + 1)] dp[0] = 0 dp[0] dp 0 0 for i in xrange(1, n + 1):
    for j in xrange(m):
        if c[j] <= i:
            dp[i] = min(dp[i], dp[i - c[j]] + 1) i xrange(1, n + 1) xrange 1 n + 1 n 1 for j in xrange(m):
        if c[j] <= i:
            dp[i] = min(dp[i], dp[i - c[j]] + 1) j xrange(m) xrange m if c[j] <= i:
            dp[i] = min(dp[i], dp[i - c[j]] + 1) c[j] <= i c[j] c j i dp[i] = min(dp[i], dp[i - c[j]] + 1) dp[i] dp i min(dp[i], dp[i - c[j]] + 1) min dp[i] dp i dp[i - c[j]] + 1 dp[i - c[j]] dp i - c[j] i c[j] c j 1 print dp[n] dp n dp = [INF for i in xrange(n + 1)] [INF for i in xrange(n + 1)] dp m = [int(x) for x in raw_input().split()] [int(x) for x in raw_input().split()] m INF = float("inf") float("inf") INF n, m = [int(x) for x in raw_input().split()] [int(x) for x in raw_input().split()] n c = [int(x) for x in raw_input().split()] [int(x) for x in raw_input().split()] c
n, m = [int(x) for x in raw_input().split()]
c = [int(x) for x in raw_input().split()]

INF = float("inf")
dp = [INF for i in xrange(n + 1)]
dp[0] = 0
for i in xrange(1, n + 1):
    for j in xrange(m):
        if c[j] <= i:
            dp[i] = min(dp[i], dp[i - c[j]] + 1)

print dp[n]