N,M=map(int,input().split())
lists=list(map(int,input().split()))
dp=[float("inf") for i in range(N+1)]
dp[0]=0
for i in range(1,N+1):
    for num in lists:
        if i>=num:
            dp[i]=min(dp[i],dp[i-num]+1)
print(dp[N]) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M lists=list(map(int,input().split())) lists list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split float("inf") for i in range(N+1) for i in range(N+1) i range(N+1) range N+1 N 1 for i in range(N+1) float("inf") float "inf" dp=[float("inf") for i in range(N+1)] dp [float("inf") for i in range(N+1)] dp[0]=0 dp[0] dp 0 0 for i in range(1,N+1):
    for num in lists:
        if i>=num:
            dp[i]=min(dp[i],dp[i-num]+1) i range(1,N+1) range 1 N+1 N 1 for num in lists:
        if i>=num:
            dp[i]=min(dp[i],dp[i-num]+1) num lists if i>=num:
            dp[i]=min(dp[i],dp[i-num]+1) i>=num i num dp[i]=min(dp[i],dp[i-num]+1) dp[i] dp i min(dp[i],dp[i-num]+1) min dp[i] dp i dp[i-num]+1 dp[i-num] dp i-num i num 1 print(dp[N]) print dp[N] dp N M=map(int,input().split()) map(int,input().split()) M dp=[float("inf") for i in range(N+1)] [float("inf") for i in range(N+1)] dp lists=list(map(int,input().split())) list(map(int,input().split())) lists N,M=map(int,input().split()) map(int,input().split()) N
N,M=map(int,input().split())
lists=list(map(int,input().split()))
dp=[float("inf") for i in range(N+1)]
dp[0]=0
for i in range(1,N+1):
    for num in lists:
        if i>=num:
            dp[i]=min(dp[i],dp[i-num]+1)
print(dp[N])
