n, m = map(int, input().split())
*C, = map(int, input().split())

dp = [n]*(n+1)
dp[0] = 0

for c in C:
    for i in range(n+1):
        if i+c > n:
            break
        dp[i+c] = min(dp[i+c], dp[i] + 1)

print(dp[n]) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m *C, = map(int, input().split()) *C C map(int, input().split()) map int input().split() ().split () input split dp = [n]*(n+1) dp [n]*(n+1) [n] n n+1 n 1 dp[0] = 0 dp[0] dp 0 0 for c in C:
    for i in range(n+1):
        if i+c > n:
            break
        dp[i+c] = min(dp[i+c], dp[i] + 1) c C for i in range(n+1):
        if i+c > n:
            break
        dp[i+c] = min(dp[i+c], dp[i] + 1) i range(n+1) range n+1 n 1 if i+c > n:
            break
         i+c > n i+c i c n break dp[i+c] = min(dp[i+c], dp[i] + 1) dp[i+c] dp i+c i c min(dp[i+c], dp[i] + 1) min dp[i+c] dp i+c i c dp[i] + 1 dp[i] dp i 1 print(dp[n]) print dp[n] dp n n, m = map(int, input().split()) map(int, input().split()) n m = map(int, input().split()) map(int, input().split()) m dp = [n]*(n+1) [n]*(n+1) dp
n, m = map(int, input().split())
*C, = map(int, input().split())

dp = [n]*(n+1)
dp[0] = 0

for c in C:
    for i in range(n+1):
        if i+c > n:
            break
        dp[i+c] = min(dp[i+c], dp[i] + 1)

print(dp[n])
