# -*- coding: utf-8 -*-
n, m = map(int,input().split())
c = [int(i) for i in input().split()] 

dp = [100000 for _ in range(n+1)]
dp[0] = 0
for i in range(1, n+1):
    for j in c:
        if 0 <= i - j:
            dp[i] = min(dp[i - j] + 1, dp[i])
print(dp[n])
 n, m = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i c = [int(i) for i in input().split()] c [int(i) for i in input().split()] 100000 for _ in range(n+1) for _ in range(n+1) _ range(n+1) range n+1 n 1 for _ in range(n+1) 100000 dp = [100000 for _ in range(n+1)] dp [100000 for _ in range(n+1)] dp[0] = 0 dp[0] dp 0 0 for i in range(1, n+1):
    for j in c:
        if 0 <= i - j:
            dp[i] = min(dp[i - j] + 1, dp[i]) i range(1, n+1) range 1 n+1 n 1 for j in c:
        if 0 <= i - j:
            dp[i] = min(dp[i - j] + 1, dp[i]) j c if 0 <= i - j:
            dp[i] = min(dp[i - j] + 1, dp[i]) 0 <= i - j 0 i - j i j dp[i] = min(dp[i - j] + 1, dp[i]) dp[i] dp i min(dp[i - j] + 1, dp[i]) min dp[i - j] + 1 dp[i - j] dp i - j i j 1 dp[i] dp i 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 c = [int(i) for i in input().split()] [int(i) for i in input().split()] c dp = [100000 for _ in range(n+1)] [100000 for _ in range(n+1)] dp
# -*- coding: utf-8 -*-
n, m = map(int,input().split())
c = [int(i) for i in input().split()] 

dp = [100000 for _ in range(n+1)]
dp[0] = 0
for i in range(1, n+1):
    for j in c:
        if 0 <= i - j:
            dp[i] = min(dp[i - j] + 1, dp[i])
print(dp[n])

