N,M = map(int, raw_input().split())
C = map(int, raw_input().split())

INF = 10**9
DP = [INF]*(N+1)
DP[0] = 0

for i in range(1, N+1):
    for c in C:
        if c <= i:
            DP[i] = min(DP[i], DP[i-c]+1)

print DP[N] 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 INF = 10**9 INF 10**9 10 9 DP = [INF]*(N+1) DP [INF]*(N+1) [INF] INF N+1 N 1 DP[0] = 0 DP[0] DP 0 0 for i in range(1, N+1):
    for c in C:
        if c <= i:
            DP[i] = min(DP[i], DP[i-c]+1) i range(1, N+1) range 1 N+1 N 1 for c in C:
        if c <= i:
            DP[i] = min(DP[i], DP[i-c]+1) c C if c <= i:
            DP[i] = min(DP[i], DP[i-c]+1) c <= i c i DP[i] = min(DP[i], DP[i-c]+1) DP[i] DP i min(DP[i], DP[i-c]+1) min DP[i] DP i DP[i-c]+1 DP[i-c] DP i-c i c 1 print DP[N] DP N M = map(int, raw_input().split()) map(int, raw_input().split()) M C = map(int, raw_input().split()) map(int, raw_input().split()) C INF = 10**9 10**9 INF DP = [INF]*(N+1) [INF]*(N+1) DP N,M = map(int, raw_input().split()) map(int, raw_input().split()) N
N,M = map(int, raw_input().split())
C = map(int, raw_input().split())

INF = 10**9
DP = [INF]*(N+1)
DP[0] = 0

for i in range(1, N+1):
    for c in C:
        if c <= i:
            DP[i] = min(DP[i], DP[i-c]+1)

print DP[N]
