n,m = map(int,input().split())
C = list(map(int,input().split()))
dp = [float('inf') for _ in range(n+1)]

for i in range(n+1):
    for c in C:
        if i + c  <= n:
            dp[i+c] = min(dp[i+c],dp[i]+1) if dp[i] != float('inf') else 1
print(dp[n]) n,m = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m C = list(map(int,input().split())) C list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split float('inf') for _ in range(n+1) for _ in range(n+1) _ range(n+1) range n+1 n 1 for _ in range(n+1) float('inf') float 'inf' dp = [float('inf') for _ in range(n+1)] dp [float('inf') for _ in range(n+1)] for i in range(n+1):
    for c in C:
        if i + c  <= n:
            dp[i+c] = min(dp[i+c],dp[i]+1) if dp[i] != float('inf') else 1 i range(n+1) range n+1 n 1 for c in C:
        if i + c  <= n:
            dp[i+c] = min(dp[i+c],dp[i]+1) if dp[i] != float('inf') else 1 c C if i + c  <= n:
            dp[i+c] = min(dp[i+c],dp[i]+1) if dp[i] != float('inf') else 1 i + c  <= n i + c i c n dp[i+c] = min(dp[i+c],dp[i]+1) if dp[i] != float('inf') else 1 dp[i+c] dp i+c i c min(dp[i+c],dp[i]+1) if dp[i] != float('inf') else 1 dp[i] != float('inf') dp[i] dp i float('inf') float 'inf' min(dp[i+c],dp[i]+1) min dp[i+c] dp i+c i c dp[i]+1 dp[i] dp i 1 1 print(dp[n]) print dp[n] dp n m = map(int,input().split()) map(int,input().split()) m n,m = map(int,input().split()) map(int,input().split()) n C = list(map(int,input().split())) list(map(int,input().split())) C dp = [float('inf') for _ in range(n+1)] [float('inf') for _ in range(n+1)] dp
n,m = map(int,input().split())
C = list(map(int,input().split()))
dp = [float('inf') for _ in range(n+1)]

for i in range(n+1):
    for c in C:
        if i + c  <= n:
            dp[i+c] = min(dp[i+c],dp[i]+1) if dp[i] != float('inf') else 1
print(dp[n])
