/*4-9汽车加油问题*/
# include <iostream>
# include <malloc.h>
using namespace std;
void F(int *d, int n, int k)
{
int num=0; //Record the times of refueling(加油)
for (int i=0; i<=k; ++i)
if (d[i]>n)
{
cout <<"No Solution"<<endl;
return;
}
for (int i=0, s=0; i<=k; ++i)
{
s+=d[i];
if (s>n)
{
num++;
s=d[i];
}
}
cout <<num<<endl;
}
int main()
{
int n, k, *d;
cin >>n>>k;
d=(int *)malloc((k+1)*sizeof(int));
for (int i=0; i<=k; ++i)
cin >>d[i];
F(d, n, k);
return 0;
}