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

dp = [float('inf')]*10**5

dp[0] = 0

for i in range(n+1):
    for c in C:
        dp[i] = min(dp[i-c]+1, dp[i])
        
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 dp = [float('inf')]*10**5 dp [float('inf')]*10**5 [float('inf')] float('inf') float 'inf' 10**5 10 5 dp[0] = 0 dp[0] dp 0 0 for i in range(n+1):
    for c in C:
        dp[i] = min(dp[i-c]+1, dp[i])
         i range(n+1) range n+1 n 1 for c in C:
        dp[i] = min(dp[i-c]+1, dp[i])
         c C dp[i] = min(dp[i-c]+1, dp[i]) dp[i] dp i min(dp[i-c]+1, dp[i]) min dp[i-c]+1 dp[i-c] dp i-c i c 1 dp[i] dp i print(dp[n]) print dp[n] dp n dp = [float('inf')]*10**5 [float('inf')]*10**5 dp 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()))

dp = [float('inf')]*10**5

dp[0] = 0

for i in range(n+1):
    for c in C:
        dp[i] = min(dp[i-c]+1, dp[i])
        
print(dp[n])
