#include <bits/stdc++.h>

using namespace std;

int main(void) {
  int n, m;
  while (cin >> n >> m, n) {
    vector<int> b(n), d(m);
    for (int i = 0; i < n; i++) {
      cin >> b[i];
    }
    for (int i = 0; i < m; i++) {
      cin >> d[i];
    }

    int pos = 0;
    for (int i = 0; i < m; i++) {
      int next = pos + d[i];
      pos = next + b[next];
      if (pos >= n - 1) {
        cout << i + 1 << endl;
        break;
      }
    }
  }

  return 0;
}
