n, m = map(int, input().split())
c = [int(i) for i in input().split()]
dp = [5*10**4]*(n+1)

dp[0] = 0
for i in range(1,n+1):
  dp[i] = min([dp[i-j]+1 for j in c if i>=j])
print(dp[n])   n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i c = [int(i) for i in input().split()] c [int(i) for i in input().split()] dp = [5*10**4]*(n+1) dp [5*10**4]*(n+1) [5*10**4] 5*10**4 5 10**4 10 4 n+1 n 1 dp[0] = 0 dp[0] dp 0 0 for i in range(1,n+1):
  dp[i] = min([dp[i-j]+1 for j in c if i>=j]) i range(1,n+1) range 1 n+1 n 1 dp[i-j]+1 for j in c if i>=j for j in c if i>=j j c i>=j i j if i>=j dp[i-j]+1 dp[i-j] dp i-j i j 1 dp[i] = min([dp[i-j]+1 for j in c if i>=j]) dp[i] dp i min([dp[i-j]+1 for j in c if i>=j]) min [dp[i-j]+1 for j in c if i>=j] print(dp[n]) print dp[n] dp n m = map(int, input().split()) map(int, input().split()) m c = [int(i) for i in input().split()] [int(i) for i in input().split()] c dp = [5*10**4]*(n+1) [5*10**4]*(n+1) dp n, m = map(int, input().split()) map(int, input().split()) n
n, m = map(int, input().split())
c = [int(i) for i in input().split()]
dp = [5*10**4]*(n+1)

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