n, m = map(int, input().split())
C = sorted([int(x) for x in input().split()])
dp = [int(x) for x in range(n + 1)]
for c in C[1:]:
    for i in range(n + 1):
        anc = i - c
        if anc < 0:
            continue
        dp[i] = min(dp[i], dp[anc] + 1)
print(dp[n])
 n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x C = sorted([int(x) for x in input().split()]) C sorted([int(x) for x in input().split()]) sorted [int(x) for x in input().split()] int(x) for x in range(n + 1) for x in range(n + 1) x range(n + 1) range n + 1 n 1 for x in range(n + 1) int(x) int x dp = [int(x) for x in range(n + 1)] dp [int(x) for x in range(n + 1)] for c in C[1:]:
    for i in range(n + 1):
        anc = i - c
        if anc < 0:
            continue
        dp[i] = min(dp[i], dp[anc] + 1) c C[1:] C 1: 1 for i in range(n + 1):
        anc = i - c
        if anc < 0:
            continue
        dp[i] = min(dp[i], dp[anc] + 1) i range(n + 1) range n + 1 n 1 anc = i - c anc i - c i c if anc < 0:
            continue
         anc < 0 anc 0 continue dp[i] = min(dp[i], dp[anc] + 1) dp[i] dp i min(dp[i], dp[anc] + 1) min dp[i] dp i dp[anc] + 1 dp[anc] dp anc 1 print(dp[n]) print dp[n] dp n C = sorted([int(x) for x in input().split()]) sorted([int(x) for x in input().split()]) C anc = i - c i - c anc m = map(int, input().split()) map(int, input().split()) m n, m = map(int, input().split()) map(int, input().split()) n dp = [int(x) for x in range(n + 1)] [int(x) for x in range(n + 1)] dp
n, m = map(int, input().split())
C = sorted([int(x) for x in input().split()])
dp = [int(x) for x in range(n + 1)]
for c in C[1:]:
    for i in range(n + 1):
        anc = i - c
        if anc < 0:
            continue
        dp[i] = min(dp[i], dp[anc] + 1)
print(dp[n])

