n, m = map(int, input().split())
C = list(map(int, input().split()))
INF = 10**5
dp = [INF for _ in range(n+1)]
dp[0] = 0
for i in range(n):
    for c in C:
        if i + c <= n:
            dp[i+c] = min(dp[i+c], dp[i]+1)
print(dp[n]) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m C = list(map(int, input().split())) C list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split INF = 10**5 INF 10**5 10 5 INF for _ in range(n+1) for _ in range(n+1) _ range(n+1) range n+1 n 1 for _ in range(n+1) INF dp = [INF for _ in range(n+1)] dp [INF for _ in range(n+1)] dp[0] = 0 dp[0] dp 0 0 for i in range(n):
    for c in C:
        if i + c <= n:
            dp[i+c] = min(dp[i+c], dp[i]+1) i range(n) range n for c in C:
        if i + c <= n:
            dp[i+c] = min(dp[i+c], dp[i]+1) c C if i + c <= n:
            dp[i+c] = min(dp[i+c], dp[i]+1) i + c <= n i + c i c n dp[i+c] = min(dp[i+c], dp[i]+1) dp[i+c] dp i+c i c min(dp[i+c], dp[i]+1) min dp[i+c] dp i+c i c dp[i]+1 dp[i] dp i 1 print(dp[n]) print dp[n] dp n dp = [INF for _ in range(n+1)] [INF for _ in range(n+1)] dp INF = 10**5 10**5 INF m = map(int, input().split()) map(int, input().split()) m C = list(map(int, input().split())) list(map(int, input().split())) C n, m = map(int, input().split()) map(int, input().split()) n
n, m = map(int, input().split())
C = list(map(int, input().split()))
INF = 10**5
dp = [INF for _ in range(n+1)]
dp[0] = 0
for i in range(n):
    for c in C:
        if i + c <= n:
            dp[i+c] = min(dp[i+c], dp[i]+1)
print(dp[n])