#include<cstdio>
using namespace std;
#define MAX_N 1000
#define MAX_M 1000

int now = 0, e[MAX_N], r[MAX_M], i, n, m;

int main(){
  while(1){
    scanf("%d %d", &n, &m);
    if(n == 0 && m == 0) break;
    now = 0;
    for(i = 0; i < n; i++) scanf("%d", &e[i]);
    for(i = 0; i < m; i++) scanf("%d", &r[i]);
    for(i = 0; i < m; i++){
      now += r[i];
      now += e[now];
      if(now >= n - 1) break;
    }
    printf("%d\n", i + 1);
  }
  return 0;
}