n, m = map(int, raw_input().split())
l = map(int, raw_input().split())
INF = 1<<31
dp = [INF]*(n+1)
dp[0] = 0
for c in l:
    for i in range(n-c+1):
        if dp[i] != INF:
            dp[i + c] = min(dp[i] + 1, dp[i + c])
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 l = map(int, raw_input().split()) l map(int, raw_input().split()) map int raw_input().split() ().split () raw_input split INF = 1<<31 INF 1<<31 1 31 dp = [INF]*(n+1) dp [INF]*(n+1) [INF] INF n+1 n 1 dp[0] = 0 dp[0] dp 0 0 for c in l:
    for i in range(n-c+1):
        if dp[i] != INF:
            dp[i + c] = min(dp[i] + 1, dp[i + c]) c l for i in range(n-c+1):
        if dp[i] != INF:
            dp[i + c] = min(dp[i] + 1, dp[i + c]) i range(n-c+1) range n-c+1 n-c n c 1 if dp[i] != INF:
            dp[i + c] = min(dp[i] + 1, dp[i + c]) dp[i] != INF dp[i] dp i INF dp[i + c] = min(dp[i] + 1, dp[i + c]) dp[i + c] dp i + c i c min(dp[i] + 1, dp[i + c]) min dp[i] + 1 dp[i] dp i 1 dp[i + c] dp i + c i c print dp[n] dp n n, m = map(int, raw_input().split()) map(int, raw_input().split()) n m = map(int, raw_input().split()) map(int, raw_input().split()) m l = map(int, raw_input().split()) map(int, raw_input().split()) l INF = 1<<31 1<<31 INF dp = [INF]*(n+1) [INF]*(n+1) dp
n, m = map(int, raw_input().split())
l = map(int, raw_input().split())
INF = 1<<31
dp = [INF]*(n+1)
dp[0] = 0
for c in l:
    for i in range(n-c+1):
        if dp[i] != INF:
            dp[i + c] = min(dp[i] + 1, dp[i + c])
print dp[n]