n, m = map(int, input().split())
d = list(map(int, input().split()))
dp = [10000 for i in range(n + 1)]
dp[0] = 0

for i in range(0, n + 1):
    if dp[i] < 10000:
        for j in d:
            if i + j <= n:
                dp[i + j] = min(dp[i] + 1, dp[i + j])

print(dp[n]) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m d = list(map(int, input().split())) d list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split 10000 for i in range(n + 1) for i in range(n + 1) i range(n + 1) range n + 1 n 1 for i in range(n + 1) 10000 dp = [10000 for i in range(n + 1)] dp [10000 for i in range(n + 1)] dp[0] = 0 dp[0] dp 0 0 for i in range(0, n + 1):
    if dp[i] < 10000:
        for j in d:
            if i + j <= n:
                dp[i + j] = min(dp[i] + 1, dp[i + j]) i range(0, n + 1) range 0 n + 1 n 1 if dp[i] < 10000:
        for j in d:
            if i + j <= n:
                dp[i + j] = min(dp[i] + 1, dp[i + j]) dp[i] < 10000 dp[i] dp i 10000 for j in d:
            if i + j <= n:
                dp[i + j] = min(dp[i] + 1, dp[i + j]) j d if i + j <= n:
                dp[i + j] = min(dp[i] + 1, dp[i + j]) i + j <= n i + j i j n dp[i + j] = min(dp[i] + 1, dp[i + j]) dp[i + j] dp i + j i j min(dp[i] + 1, dp[i + j]) min dp[i] + 1 dp[i] dp i 1 dp[i + j] dp i + j i j print(dp[n]) print dp[n] dp n d = list(map(int, input().split())) list(map(int, input().split())) d n, m = map(int, input().split()) map(int, input().split()) n m = map(int, input().split()) map(int, input().split()) m dp = [10000 for i in range(n + 1)] [10000 for i in range(n + 1)] dp
n, m = map(int, input().split())
d = list(map(int, input().split()))
dp = [10000 for i in range(n + 1)]
dp[0] = 0

for i in range(0, n + 1):
    if dp[i] < 10000:
        for j in d:
            if i + j <= n:
                dp[i + j] = min(dp[i] + 1, dp[i + j])

print(dp[n])