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

dp = [0] * (n+1)

for i in range(1, n+1):
  dpi = 10 ** 9
  for j in range(m):
    if(i-c[j]>=0):
      tmp = dp[i-c[j]] + 1
      if(tmp < dpi):
        dpi = tmp
  dp[i] = dpi
  
  
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 = [0] * (n+1) dp [0] * (n+1) [0] 0 n+1 n 1 for i in range(1, n+1):
  dpi = 10 ** 9
  for j in range(m):
    if(i-c[j]>=0):
      tmp = dp[i-c[j]] + 1
      if(tmp < dpi):
        dpi = tmp
  dp[i] = dpi
  
   i range(1, n+1) range 1 n+1 n 1 dpi = 10 ** 9 dpi 10 ** 9 10 9 for j in range(m):
    if(i-c[j]>=0):
      tmp = dp[i-c[j]] + 1
      if(tmp < dpi):
        dpi = tmp
   j range(m) range m if(i-c[j]>=0):
      tmp = dp[i-c[j]] + 1
      if(tmp < dpi):
        dpi = tmp
   i-c[j]>=0 i-c[j] i c[j] c j 0 tmp = dp[i-c[j]] + 1 tmp dp[i-c[j]] + 1 dp[i-c[j]] dp i-c[j] i c[j] c j 1 if(tmp < dpi):
        dpi = tmp
   tmp < dpi tmp dpi dpi = tmp dpi tmp dp[i] = dpi dp[i] dp i dpi print(dp[n]) print dp[n] dp n dpi = tmp tmp dpi n, m = map(int, input().split()) map(int, input().split()) n m = map(int, input().split()) map(int, input().split()) m tmp = dp[i-c[j]] + 1 dp[i-c[j]] + 1 tmp dp = [0] * (n+1) [0] * (n+1) dp c = list(map(int, input().split())) list(map(int, input().split())) c dpi = 10 ** 9 10 ** 9 dpi
n, m = map(int, input().split())
c = list(map(int, input().split()))

dp = [0] * (n+1)

for i in range(1, n+1):
  dpi = 10 ** 9
  for j in range(m):
    if(i-c[j]>=0):
      tmp = dp[i-c[j]] + 1
      if(tmp < dpi):
        dpi = tmp
  dp[i] = dpi
  
  
print(dp[n])
