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

dp = [None]*50001
for i in c:
    dp[i] = 1

for i in range(1,n+1):
    if dp[i]:
        continue
    min_count = float('inf')
    for j in c:
        if i-j>0:
            min_count = min(min_count,1+dp[i-j])
            
    dp[i] = min_count
    
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 = [None]*50001 dp [None]*50001 [None] None 50001 for i in c:
    dp[i] = 1 i c dp[i] = 1 dp[i] dp i 1 for i in range(1,n+1):
    if dp[i]:
        continue
    min_count = float('inf')
    for j in c:
        if i-j>0:
            min_count = min(min_count,1+dp[i-j])
            
    dp[i] = min_count
     i range(1,n+1) range 1 n+1 n 1 if dp[i]:
        continue
     dp[i] dp i continue min_count = float('inf') min_count float('inf') float 'inf' for j in c:
        if i-j>0:
            min_count = min(min_count,1+dp[i-j])
            
     j c if i-j>0:
            min_count = min(min_count,1+dp[i-j])
            
     i-j>0 i-j i j 0 min_count = min(min_count,1+dp[i-j]) min_count min(min_count,1+dp[i-j]) min min_count 1+dp[i-j] 1 dp[i-j] dp i-j i j dp[i] = min_count dp[i] dp i min_count print(dp[n]) print dp[n] dp n min_count = float('inf') float('inf') min_count min_count = min(min_count,1+dp[i-j]) min(min_count,1+dp[i-j]) min_count m = map(int,input().split()) map(int,input().split()) m n,m = map(int,input().split()) map(int,input().split()) n c = list(map(int,input().split())) list(map(int,input().split())) c dp = [None]*50001 [None]*50001 dp
n,m = map(int,input().split())
c = list(map(int,input().split()))

dp = [None]*50001
for i in c:
    dp[i] = 1

for i in range(1,n+1):
    if dp[i]:
        continue
    min_count = float('inf')
    for j in c:
        if i-j>0:
            min_count = min(min_count,1+dp[i-j])
            
    dp[i] = min_count
    
print(dp[n])
