#include <iostream>
using namespace std;

#define loop(i,n) for(int i=1;i<=n;i++)
int n,m;
int order[1002];
int dice[1002];

int solve(){
  int pos=1;
  loop(i,n)cin>>order[i];
  loop(j,m)cin>>dice[j];
  for(int t=1;t<=m;t++){
    pos+=dice[t];
    if(pos>=n)return t;
    pos+=order[pos];
    if(pos>=n)return t;
  }
}

int main(){
  cin>>n>>m;
  while(n||m){
    cout<<solve()<<endl;
    cin>>n>>m;
  }
  return 0;
}