#include <iostream>
using namespace std;

int main() {
	int N, M, a[1001], b[1001], now, i;
	while (cin >> N >> M, N, M) {
		now = 1;
		for (i = 1; i<=N; i++) {
			cin >> a[i];
		}
		for (i = 1; i<=M; i++) {
			cin >> b[i];
		}
		for (i = 1; i<=M; i++) {
			now += b[i];
			if(now < N)now += a[now];
			if (now >= N) break;
		}
		cout << i << endl;
	}
}