n, m = map(int, input().split())
C = list(map(int, input().split()))
dp = [100000] * (n + 1)
dp[0] = 0
for k in C:
    for i, t in enumerate(zip(dp[k:], dp), start = k):
        a, b = t
        dp[i] = min(a, b + 1)
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 = [100000] * (n + 1) dp [100000] * (n + 1) [100000] 100000 n + 1 n 1 dp[0] = 0 dp[0] dp 0 0 for k in C:
    for i, t in enumerate(zip(dp[k:], dp), start = k):
        a, b = t
        dp[i] = min(a, b + 1) k C for i, t in enumerate(zip(dp[k:], dp), start = k):
        a, b = t
        dp[i] = min(a, b + 1) i t enumerate(zip(dp[k:], dp), start = k) enumerate zip(dp[k:], dp) zip dp[k:] dp k: k dp start = k start k a, b = t a t b dp[i] = min(a, b + 1) dp[i] dp i min(a, b + 1) min a b + 1 b 1 print(dp[n]) print dp[n] dp n dp = [100000] * (n + 1) [100000] * (n + 1) dp C = list(map(int, input().split())) list(map(int, input().split())) C a, b = t t a b = t t b n, m = map(int, input().split()) map(int, input().split()) n m = map(int, input().split()) map(int, input().split()) m
n, m = map(int, input().split())
C = list(map(int, input().split()))
dp = [100000] * (n + 1)
dp[0] = 0
for k in C:
    for i, t in enumerate(zip(dp[k:], dp), start = k):
        a, b = t
        dp[i] = min(a, b + 1)
print(dp[n])