#include<stdio.h>
int n,m;
int c[20],array[50001];
void bubblesort(void);
void survey(int,int *);

int main(void){
    int i,v;
    scanf("%d%d",&n,&m);
    for(i = 0;i < m;i++){
        scanf("%d",&c[i]);
    }
    array[0] = 0;
    bubblesort();
    v = 0;
    for(i = 1;i < n + 1;i++){
        survey(i,&v);
    }
    printf("%d\n",array[n]);
    return 0;
}

void bubblesort(void){
    int i,j,k;
    for(i = m;i > 1;i--){
        for(j = 1;j < i - 1;j++){
            if(c[j - 1] > c[j]){
                k = c[j]; c[j] = c[j - 1]; c[j - 1] = k;
            }
        }
    }
    return;
}

void survey(int p, int *q){
    int i,reply;
    if(p >= c[*q + 1] && *q < m - 1){
        (*q)++;
    }
    reply = 50001;
    for(i = 0;i < *q + 1;i++){
        if(reply > array[p - c[i]] + 1){
            reply = array[p - c[i]] + 1;
        }
    }
    array[p] = reply;
}