n, m = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
dp = [100000] * (n + 1)
dp[0] = 0
for k in C:
    for j in range(k, n + 1):
        if dp[j] > dp[j - k] + 1:
            dp[j] = dp[j - k] + 1
print(dp[n]) 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 n, m = [int(i) for i in input().split()] n [int(i) for i in 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 = [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 j in range(k, n + 1):
        if dp[j] > dp[j - k] + 1:
            dp[j] = dp[j - k] + 1 k C for j in range(k, n + 1):
        if dp[j] > dp[j - k] + 1:
            dp[j] = dp[j - k] + 1 j range(k, n + 1) range k n + 1 n 1 if dp[j] > dp[j - k] + 1:
            dp[j] = dp[j - k] + 1 dp[j] > dp[j - k] + 1 dp[j] dp j dp[j - k] + 1 dp[j - k] dp j - k j k 1 dp[j] = dp[j - k] + 1 dp[j] dp j dp[j - k] + 1 dp[j - k] dp j - k j k 1 print(dp[n]) print dp[n] dp n m = [int(i) for i in input().split()] [int(i) for i in input().split()] m dp = [100000] * (n + 1) [100000] * (n + 1) dp C = [int(i) for i in input().split()] [int(i) for i in input().split()] C n, m = [int(i) for i in input().split()] [int(i) for i in input().split()] n
n, m = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
dp = [100000] * (n + 1)
dp[0] = 0
for k in C:
    for j in range(k, n + 1):
        if dp[j] > dp[j - k] + 1:
            dp[j] = dp[j - k] + 1
print(dp[n])