n, m = map(int, raw_input().split())
c = map(int, raw_input().split())
dp = [n+1] * (n+1)
dp[n] = 0
for rest in xrange(n, 0, -1):
    for i in xrange(m):
        if c[i] <= rest:
            dp[rest - c[i]] = min(dp[rest - c[i]], 1 + dp[rest])
print dp[0] n, m = map(int, raw_input().split()) n map(int, raw_input().split()) map int raw_input().split() ().split () raw_input split m c = map(int, raw_input().split()) c map(int, raw_input().split()) map int raw_input().split() ().split () raw_input split dp = [n+1] * (n+1) dp [n+1] * (n+1) [n+1] n+1 n 1 n+1 n 1 dp[n] = 0 dp[n] dp n 0 for rest in xrange(n, 0, -1):
    for i in xrange(m):
        if c[i] <= rest:
            dp[rest - c[i]] = min(dp[rest - c[i]], 1 + dp[rest]) rest xrange(n, 0, -1) xrange n 0 -1 for i in xrange(m):
        if c[i] <= rest:
            dp[rest - c[i]] = min(dp[rest - c[i]], 1 + dp[rest]) i xrange(m) xrange m if c[i] <= rest:
            dp[rest - c[i]] = min(dp[rest - c[i]], 1 + dp[rest]) c[i] <= rest c[i] c i rest dp[rest - c[i]] = min(dp[rest - c[i]], 1 + dp[rest]) dp[rest - c[i]] dp rest - c[i] rest c[i] c i min(dp[rest - c[i]], 1 + dp[rest]) min dp[rest - c[i]] dp rest - c[i] rest c[i] c i 1 + dp[rest] 1 dp[rest] dp rest print dp[0] dp 0 m = map(int, raw_input().split()) map(int, raw_input().split()) m dp = [n+1] * (n+1) [n+1] * (n+1) dp n, m = map(int, raw_input().split()) map(int, raw_input().split()) n c = map(int, raw_input().split()) map(int, raw_input().split()) c
n, m = map(int, raw_input().split())
c = map(int, raw_input().split())
dp = [n+1] * (n+1)
dp[n] = 0
for rest in xrange(n, 0, -1):
    for i in xrange(m):
        if c[i] <= rest:
            dp[rest - c[i]] = min(dp[rest - c[i]], 1 + dp[rest])
print dp[0]