import std.stdio,std.range,std.algorithm,std.conv,std.array,std.string;

void main()
{
    int[1000] field;
    int[1000] dice;

    while(true)
    {
        auto input=readln.split;
        int N=input[0].to!int;
        int M=input[1].to!int;
        if(N==0&&M==0)break;

        foreach(i; 0..N)
        {
            field[i]=readln.chomp.to!int;
        }
        foreach(i; 0..M)
        {
            dice[i]=readln.chomp.to!int;
        }

        int i, cur;
        while(true)
        {
            cur+=dice[i++];
            if(cur >= N - 1) break;
            cur+=field[cur];
            if(cur >= N - 1) break;
        }
        i.writeln;
    }
}