//O(n^2)
#include<stdio.h>
#include<math.h>

long long n,rui[10000];

long long max( long long x,long long y ){
	if( x > y )
		return x;
	return y;
}

int main()
{
	long long i,j;
	long long ans;
	while( scanf("%lld",&n) != EOF )
	{
		if( n == 0 )break;
		ans = -10000000000;
		for( i = 0;i < n;i++ ){
			scanf("%lld",rui+i );
			if( i )rui[i] += rui[i-1];
		}
		
		for( i = 0;i < n;i++ ){
			for( j = i;j < n;j++ ){
				if( i )
					ans = max( ans, rui[j]-rui[i-1] );
				else
					ans = max( ans,rui[j] );
			}
		}
		
		printf("%lld\n",ans);
	}
	return 0;
}
#include <bits/stdc++.h>

using namespace std;

int N, M;
vector<int> ItemInfo, PersonInfo;

void solve() {
	int curValue;
	int total[1000];

	memset(total, 0, sizeof(total));
	for (int i = 0; i < M; ++i) {
		curValue = PersonInfo[i];
		for (int j = 0; j < N; ++j) {
			if (ItemInfo[j] <= curValue) {
				//cout << "=" << j + 1 << endl;
				++total[j];
				break;
			}
		}
	}

	cout << max_element(total, total + N) - total + 1 << endl;
}

int main() {
	int num;

	cin >> N >> M;
	for (int i = 0; i < N; ++i) {
		cin >> num;
		ItemInfo.push_back(num);
	}
	for (int i = 0; i < M; ++i) {
		cin >> num;
		PersonInfo.push_back(num);
	}
	solve();

	return 0;
}
