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

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

cash=[0 for i in range(n+1)]

for i in range(1,n+1):
  for j in range(m):
    if (i-c[j])>=0:
      coins=cash[i-c[j]]+1
      if cash[i]==0:
        cash[i]=coins
      elif cash[i]>coins:
        cash[i]=coins

print(cash[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 0 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) 0 cash=[0 for i in range(n+1)] cash [0 for i in range(n+1)] for i in range(1,n+1):
  for j in range(m):
    if (i-c[j])>=0:
      coins=cash[i-c[j]]+1
      if cash[i]==0:
        cash[i]=coins
      elif cash[i]>coins:
        cash[i]=coins i range(1,n+1) range 1 n+1 n 1 for j in range(m):
    if (i-c[j])>=0:
      coins=cash[i-c[j]]+1
      if cash[i]==0:
        cash[i]=coins
      elif cash[i]>coins:
        cash[i]=coins j range(m) range m if (i-c[j])>=0:
      coins=cash[i-c[j]]+1
      if cash[i]==0:
        cash[i]=coins
      elif cash[i]>coins:
        cash[i]=coins (i-c[j])>=0 i-c[j] i c[j] c j 0 coins=cash[i-c[j]]+1 coins cash[i-c[j]]+1 cash[i-c[j]] cash i-c[j] i c[j] c j 1 if cash[i]==0:
        cash[i]=coins
      elif cash[i]>coins:
        cash[i]=coins cash[i]==0 cash[i] cash i 0 cash[i]=coins cash[i] cash i coins elif cash[i]>coins:
        cash[i]=coins cash[i]>coins cash[i] cash i coins cash[i]=coins cash[i] cash i coins print(cash[n]) print cash[n] cash n m=map(int,input().split()) map(int,input().split()) m cash=[0 for i in range(n+1)] [0 for i in range(n+1)] cash n,m=map(int,input().split()) map(int,input().split()) n coins=cash[i-c[j]]+1 cash[i-c[j]]+1 coins c=list(map(int,input().split())) list(map(int,input().split())) c
n,m=map(int,input().split())

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

cash=[0 for i in range(n+1)]

for i in range(1,n+1):
  for j in range(m):
    if (i-c[j])>=0:
      coins=cash[i-c[j]]+1
      if cash[i]==0:
        cash[i]=coins
      elif cash[i]>coins:
        cash[i]=coins

print(cash[n])
