#include<iostream>
#include<iomanip>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;


int main(){
long long s,n,maxcard,numberOfMaxCards,leftover=-1,ANSWER=0,maxcardi;
cin>>s>>n;
long long arr[n];
for(int i=0;i<n;i++){
    cin>>arr[i];
    if(arr[i]>s)arr[i]=-1;  //we don't have to worry about elements bigger than s
}
maxcard=arr[0];
maxcardi=0;
while(leftover!=0){
    for(int i=0;i<n;i++){
        if(arr[i]>maxcard && arr[i]<=s){
            maxcard=arr[i];
            maxcardi=i;
        }
    }
    numberOfMaxCards=s/maxcard;  //what is the amount of maxcards needed to get the closest to s

    leftover=s%maxcard; //what is left after that



    ANSWER+=numberOfMaxCards;   //adds numberOfMaxCards to the ANSWER
    //cout<<"\nWhen S was "<<s;
    //cout<<" We used maxcard: "<<maxcard<<" this number of times: "<<numberOfMaxCards<<" so answer is now "<<ANSWER<<endl;

    s=leftover;   //makes s the new amount needed to be reached

    arr[maxcardi]=-1;
    maxcard=-1;
}

cout<<ANSWER;
return 0;
}
/*678 5
7 4 9 34 6*/
