#include<iostream>
#define MAX 2000
using namespace std;
int main(){
	int n,m;
	int f[MAX],s[MAX];
	while(cin>>n>>m,n||m){
		for(int i=1;i<=n;i++)
			cin>>f[i];
		for(int i=0;i<m;i++){
			cin>>s[i];
		}
		int now=1;
		for(int i=0;;i++){
			now+=s[i];
			if(now>=n){
				cout<<i+1<<endl;
				break;
			}else{
				now+=f[now];
				if(now>=n){
				cout<<i+1<<endl;
				break;
				}
			}
			
//			cout<<"   "<<now<<endl;

		}
	}
	return 0;
}