
#include<iostream>
#include<vector>
using namespace std;

int main()
{
  int N,M,i;
  int pos,goal;
  int t;
  vector<int> v;
  while(cin>>N>>M,N||M){
    v.resize(N);
    for(i=0;i<N;i++){
      cin>>t;
      v[i]=t;
    }

    goal=0;
    pos=0;
    for(i=0;i<M;i++){
      cin>>t;
      if(goal)continue;
      pos+=t;
      if(pos>=N-1) goal=i+1;
      pos+=v[pos];
      if(pos>=N-1) goal=i+1;
    }

    cout<<goal<<endl;
  }
}