#include <iostream>
using namespace std;

int nibun(long long int a[], int s, int e, int k){
	if(s > e) return s - 1;
	if(a[(s+e)/2] == k){
		return (s+e)/2;
	}
	else if(a[(s+e)/2] < k) nibun(a, (s+e)/2+1, e, k);
	else if(a[(s+e)/2] > k) nibun(a, s, (s+e)/2-1, k);
}

int main(){
	long long int a[150], n, m, s, max, tmp, flag;
	while(cin >> m >> n){
		if(!m && !n) break;
		max = 0;
		a[0] = 0;
		flag = 0;
		for(int i = 1;i<=n;i++){
			cin >> tmp;
			a[i] = a[i-1] + tmp;
		}
		for(int i = 1;i<1500001;i++){
			if(nibun(a, 0, n, i * m) >= n ){
				tmp = 0;
				max = i;
				flag = 1;
				for(int j = 0;j<m;j++){
					if(i < a[nibun(a, 0, n, i * (j + 1))] - a[nibun(a, 0, n, i*j)]){
					 	flag = 0;
					 	break;
					 }
				}
			}
			if(flag) break;
		}
		cout << max << endl;
	}
	return 0;
}