n, m = map(int, input().split())
D = list(map(int, input().split()))

INF = int(1e18)

# dp[i]: i円をDで支払うときの最小枚数
dp = [INF] * (n + 1)
dp[0] = 0
for i in range(1, n + 1):
    for d in D:
        if i - d >= 0:
            dp[i] = min(dp[i], dp[i - d] + 1)
        else:
            dp[i] = dp[i]

print(dp[n]) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m D = list(map(int, input().split())) D list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split INF = int(1e18) INF int(1e18) int 1e18 dp = [INF] * (n + 1) dp [INF] * (n + 1) [INF] INF n + 1 n 1 dp[0] = 0 dp[0] dp 0 0 for i in range(1, n + 1):
    for d in D:
        if i - d >= 0:
            dp[i] = min(dp[i], dp[i - d] + 1)
        else:
            dp[i] = dp[i] i range(1, n + 1) range 1 n + 1 n 1 for d in D:
        if i - d >= 0:
            dp[i] = min(dp[i], dp[i - d] + 1)
        else:
            dp[i] = dp[i] d D if i - d >= 0:
            dp[i] = min(dp[i], dp[i - d] + 1)
        else:
            dp[i] = dp[i] i - d >= 0 i - d i d 0 dp[i] = min(dp[i], dp[i - d] + 1) dp[i] dp i min(dp[i], dp[i - d] + 1) min dp[i] dp i dp[i - d] + 1 dp[i - d] dp i - d i d 1 dp[i] = dp[i] dp[i] dp i dp[i] dp i print(dp[n]) print dp[n] dp n D = list(map(int, input().split())) list(map(int, input().split())) D dp = [INF] * (n + 1) [INF] * (n + 1) dp INF = int(1e18) int(1e18) INF 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())
D = list(map(int, input().split()))

INF = int(1e18)

# dp[i]: i円をDで支払うときの最小枚数
dp = [INF] * (n + 1)
dp[0] = 0
for i in range(1, n + 1):
    for d in D:
        if i - d >= 0:
            dp[i] = min(dp[i], dp[i - d] + 1)
        else:
            dp[i] = dp[i]

print(dp[n])
