#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
	int n, m, f[1000], x;
	while (cin >> n >> m && n != 0) {
		int pos = 0, ans = 0;
		for (int i = 0; i < n; ++i) {
			cin >> f[i];
		}
		while (m--) {
			cin >> x;
			pos += x;
			ans++;
			if (pos >= n - 1)
				break;
			pos += f[pos];
			if (pos >= n - 1)
				break;
		}
		while (m--) {
			cin >> x;
		}

		cout << ans << endl;
	}
	
	return 0;
}