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

inf = float("inf")
dp = [inf]*(n+2)

dp[0]= 0

for i in range(1,n+1):
  for coin in coins:
    if i-coin>=0:
      dp[i]=  min(dp[i-coin]+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 coins = list(map(int,input().split())) coins list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split inf = float("inf") inf float("inf") float "inf" dp = [inf]*(n+2) dp [inf]*(n+2) [inf] inf n+2 n 2 dp[0]= 0 dp[0] dp 0 0 for i in range(1,n+1):
  for coin in coins:
    if i-coin>=0:
      dp[i]=  min(dp[i-coin]+1,dp[i])
     i range(1,n+1) range 1 n+1 n 1 for coin in coins:
    if i-coin>=0:
      dp[i]=  min(dp[i-coin]+1,dp[i])
     coin coins if i-coin>=0:
      dp[i]=  min(dp[i-coin]+1,dp[i])
     i-coin>=0 i-coin i coin 0 dp[i]=  min(dp[i-coin]+1,dp[i]) dp[i] dp i min(dp[i-coin]+1,dp[i]) min dp[i-coin]+1 dp[i-coin] dp i-coin i coin 1 dp[i] dp i print(dp[n]) print dp[n] dp n m = map(int,input().split()) map(int,input().split()) m coins = list(map(int,input().split())) list(map(int,input().split())) coins n,m = map(int,input().split()) map(int,input().split()) n inf = float("inf") float("inf") inf dp = [inf]*(n+2) [inf]*(n+2) dp
n,m = map(int,input().split())
coins = list(map(int,input().split()))

inf = float("inf")
dp = [inf]*(n+2)

dp[0]= 0

for i in range(1,n+1):
  for coin in coins:
    if i-coin>=0:
      dp[i]=  min(dp[i-coin]+1,dp[i])
    
print(dp[n])
