#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	int n,m,mas[1001]={0},eye[1001]={0},count,place;
	while(1){
		count=0;
		cin>>n>>m;
		if(n==0 && m==0){
			break;
		}
		for(int i=0;i<n;++i){
			cin>>mas[i];
		}
		for(int i=0;i<m;++i){
			cin>>eye[i];
		}
		count=0;place=0;
		while(1){
			if(place>=n-1){
				break;
			}
			place+=eye[count];
			place+=mas[place];
			count++;
		}
		cout<<count<<endl;
	}
	return 0;
}