N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

dp = [0] * (N + 1)

for i in range(1, N + 1):
    tmp = float("inf")
    for j in A:
        if i - j >= 0:
            tmp = min(tmp, dp[i - j])
    dp[i] = tmp + 1

print(dp[N])


 int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x N, M = [int(x) for x in input().split()] N [int(x) for x in input().split()] M int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x A = [int(x) for x in input().split()] A [int(x) for x in input().split()] dp = [0] * (N + 1) dp [0] * (N + 1) [0] 0 N + 1 N 1 for i in range(1, N + 1):
    tmp = float("inf")
    for j in A:
        if i - j >= 0:
            tmp = min(tmp, dp[i - j])
    dp[i] = tmp + 1 i range(1, N + 1) range 1 N + 1 N 1 tmp = float("inf") tmp float("inf") float "inf" for j in A:
        if i - j >= 0:
            tmp = min(tmp, dp[i - j])
     j A if i - j >= 0:
            tmp = min(tmp, dp[i - j])
     i - j >= 0 i - j i j 0 tmp = min(tmp, dp[i - j]) tmp min(tmp, dp[i - j]) min tmp dp[i - j] dp i - j i j dp[i] = tmp + 1 dp[i] dp i tmp + 1 tmp 1 print(dp[N]) print dp[N] dp N A = [int(x) for x in input().split()] [int(x) for x in input().split()] A tmp = min(tmp, dp[i - j]) min(tmp, dp[i - j]) tmp M = [int(x) for x in input().split()] [int(x) for x in input().split()] M N, M = [int(x) for x in input().split()] [int(x) for x in input().split()] N tmp = float("inf") float("inf") tmp dp = [0] * (N + 1) [0] * (N + 1) dp
N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

dp = [0] * (N + 1)

for i in range(1, N + 1):
    tmp = float("inf")
    for j in A:
        if i - j >= 0:
            tmp = min(tmp, dp[i - j])
    dp[i] = tmp + 1

print(dp[N])



