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