#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)

int main(){
	int n,m;
	int f[1024];
	while(scanf("%d %d",&n,&m),n|m){
		rep(i,n)scanf("%d",&f[i]);
		int cnt = 0;
		int now = 1;
		rep(i,m){
			int a; scanf("%d",&a);
			if( now<n ){
				now += a;
				now += f[now-1];
				cnt++;
			}
		}
		printf("%d\n",cnt);
	}
	return 0;
}