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

INF = 10**5
dp = [INF for i in range(n+1)]
dp[0] = 0

for i in range(n+1):
    for d in D:
        if i+d <= n:
            dp[i+d] = min(dp[i+d],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 D = list(map(int,input().split())) D 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 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) INF dp = [INF for i in range(n+1)] dp [INF for i in range(n+1)] dp[0] = 0 dp[0] dp 0 0 for i in range(n+1):
    for d in D:
        if i+d <= n:
            dp[i+d] = min(dp[i+d],dp[i]+1) i range(n+1) range n+1 n 1 for d in D:
        if i+d <= n:
            dp[i+d] = min(dp[i+d],dp[i]+1) d D if i+d <= n:
            dp[i+d] = min(dp[i+d],dp[i]+1) i+d <= n i+d i d n dp[i+d] = min(dp[i+d],dp[i]+1) dp[i+d] dp i+d i d min(dp[i+d],dp[i]+1) min dp[i+d] dp i+d i d dp[i]+1 dp[i] dp i 1 print(dp[n]) print dp[n] dp n INF = 10**5 10**5 INF dp = [INF for i in range(n+1)] [INF for i in range(n+1)] dp n,m = map(int,input().split()) map(int,input().split()) n m = map(int,input().split()) map(int,input().split()) m D = list(map(int,input().split())) list(map(int,input().split())) D
n,m = map(int,input().split())
D = list(map(int,input().split()))

INF = 10**5
dp = [INF for i in range(n+1)]
dp[0] = 0

for i in range(n+1):
    for d in D:
        if i+d <= n:
            dp[i+d] = min(dp[i+d],dp[i]+1)
print(dp[n])

