#include <iostream>
using namespace std;

int field[1000];

int main()
{
	int n,m;
	while(cin >> n >> m){
		if(!n&&!m)
			break;
		for(int i=0;i<n;i++){
			cin >> field[i];
		}
		int count = 1000000000;
		int pos = 0;
		int cnt = 0;
		for(int i=0;i<m;i++){
			cnt++;
			int a;
			cin >> a;
			pos+=a;
			if(pos < n)
				pos = pos + field[pos];
			if(pos >= n-1 && count > cnt)
					count = cnt;
		}
		cout << count << endl;
	}
	return 0;
}