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

int main(){
  int n,m,mas[1201];
  while(cin >> n >> m,n||m){
    queue <int> que;
    for(int i=0;i<n;i++) cin >> mas[i];
    for(int i=0;i<m;i++){
      int t; cin >> t; que.push(t);
    }
    int now = 0,a = 0;
    while(true){
      if(now >= n - 1) break;
      int p = que.front(); now += p; que.pop(); a++;
      now += mas[now];
    }
    cout << a << endl;
  }
}