n,m=map(int,input().split())
a=[i for i in range(n+1)]
for i in list(map(int,input().split())):
    for j in range(i,n+1):
        a[j]=min(a[j-i]+1,a[j])
print(a[-1]) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m i 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) i a=[i for i in range(n+1)] a [i for i in range(n+1)] for i in list(map(int,input().split())):
    for j in range(i,n+1):
        a[j]=min(a[j-i]+1,a[j]) i list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for j in range(i,n+1):
        a[j]=min(a[j-i]+1,a[j]) j range(i,n+1) range i n+1 n 1 a[j]=min(a[j-i]+1,a[j]) a[j] a j min(a[j-i]+1,a[j]) min a[j-i]+1 a[j-i] a j-i j i 1 a[j] a j print(a[-1]) print a[-1] a -1 n,m=map(int,input().split()) map(int,input().split()) n m=map(int,input().split()) map(int,input().split()) m a=[i for i in range(n+1)] [i for i in range(n+1)] a
n,m=map(int,input().split())
a=[i for i in range(n+1)]
for i in list(map(int,input().split())):
    for j in range(i,n+1):
        a[j]=min(a[j-i]+1,a[j])
print(a[-1])
