n, m = list(map(int, input().split()))

cs = list(map(int, input().split()))
_max = 10 ** 1000

dp = [_max for _ in range(n+1)]
dp[1] = 1
dp[0] = 0

for i in range(2, n+1):
    for c in cs:
        if i-c >= 0:
            dp[i] = min(dp[i], dp[i-c]+1)

print(dp[n])
  n, m = list(map(int, input().split())) n list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split m cs = list(map(int, input().split())) cs list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split _max = 10 ** 1000 _max 10 ** 1000 10 1000 _max for _ in range(n+1) for _ in range(n+1) _ range(n+1) range n+1 n 1 for _ in range(n+1) _max dp = [_max for _ in range(n+1)] dp [_max for _ in range(n+1)] dp[1] = 1 dp[1] dp 1 1 dp[0] = 0 dp[0] dp 0 0 for i in range(2, n+1):
    for c in cs:
        if i-c >= 0:
            dp[i] = min(dp[i], dp[i-c]+1) i range(2, n+1) range 2 n+1 n 1 for c in cs:
        if i-c >= 0:
            dp[i] = min(dp[i], dp[i-c]+1) c cs if i-c >= 0:
            dp[i] = min(dp[i], dp[i-c]+1) i-c >= 0 i-c i c 0 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]) print dp[n] dp n n, m = list(map(int, input().split())) list(map(int, input().split())) n _max = 10 ** 1000 10 ** 1000 _max cs = list(map(int, input().split())) list(map(int, input().split())) cs dp = [_max for _ in range(n+1)] [_max for _ in range(n+1)] dp m = list(map(int, input().split())) list(map(int, input().split())) m
n, m = list(map(int, input().split()))

cs = list(map(int, input().split()))
_max = 10 ** 1000

dp = [_max for _ in range(n+1)]
dp[1] = 1
dp[0] = 0

for i in range(2, n+1):
    for c in cs:
        if i-c >= 0:
            dp[i] = min(dp[i], dp[i-c]+1)

print(dp[n])
 
