n,m = map(int,input().split(" "))
c = tuple(map(int,input().split(" ")))
m = min(c)
dp = [2**60 for _ in range(n+1)]
dp[0] = 0
for i in range(1,n+1):
    for v in c:
        if i >= v:
            dp[i] = min(dp[i],dp[i-v]+1)
print(dp[n]) n,m = map(int,input().split(" ")) n map(int,input().split(" ")) map int input().split(" ") ().split () input split " " m c = tuple(map(int,input().split(" "))) c tuple(map(int,input().split(" "))) tuple map(int,input().split(" ")) map int input().split(" ") ().split () input split " " m = min(c) m min(c) min c 2**60 for _ in range(n+1) for _ in range(n+1) _ range(n+1) range n+1 n 1 for _ in range(n+1) 2**60 2 60 dp = [2**60 for _ in range(n+1)] dp [2**60 for _ in range(n+1)] dp[0] = 0 dp[0] dp 0 0 for i in range(1,n+1):
    for v in c:
        if i >= v:
            dp[i] = min(dp[i],dp[i-v]+1) i range(1,n+1) range 1 n+1 n 1 for v in c:
        if i >= v:
            dp[i] = min(dp[i],dp[i-v]+1) v c if i >= v:
            dp[i] = min(dp[i],dp[i-v]+1) i >= v i v dp[i] = min(dp[i],dp[i-v]+1) dp[i] dp i min(dp[i],dp[i-v]+1) min dp[i] dp i dp[i-v]+1 dp[i-v] dp i-v i v 1 print(dp[n]) print dp[n] dp n m = min(c) min(c) m dp = [2**60 for _ in range(n+1)] [2**60 for _ in range(n+1)] dp n,m = map(int,input().split(" ")) map(int,input().split(" ")) n m = map(int,input().split(" ")) map(int,input().split(" ")) m c = tuple(map(int,input().split(" "))) tuple(map(int,input().split(" "))) c
n,m = map(int,input().split(" "))
c = tuple(map(int,input().split(" ")))
m = min(c)
dp = [2**60 for _ in range(n+1)]
dp[0] = 0
for i in range(1,n+1):
    for v in c:
        if i >= v:
            dp[i] = min(dp[i],dp[i-v]+1)
print(dp[n])
