#include<stdio.h>
int main()
{
    int S, N, sum=0;
    scanf("%d %d",&S,&N);
    int numbers[N], i, max=0,counter=0;
    for(i = 0; i<N; i++)
    {
        scanf("%d",&numbers[i]);
        max = numbers[i];
    }
    while(sum+max<S)
    {
        sum = sum + max;
        counter++;
    }
    while(sum<S)
    {
        for(i = 0; i<N; i++)
        {
            if(sum + numbers[i] <= S)
            {
                sum = sum + numbers[i];
                counter++;
            }
        }
    }
    printf("%d",counter);
    return 0;
}