import std.stdio;
import std.c.stdio;
import std.algorithm;
import std.array;

void main() {
    int roulette; 
test:
    while (scanf("%d", &roulette), roulette) {
        int n; scanf("%d", &n);
        int[] d = new int[n + 2];
        foreach (i; 1 .. n + 1) scanf("%d", &d[i]);
        int next(int x) {
            int ans = x + d[x];
            if (ans < 0) ans = 0;
            if (ans > n + 1) ans = n + 1;
            return ans;
        }
        int[][] graph = new int[][n + 2];
        bool[] used = new bool[n + 2];
        void make(int cur) {
            used[cur] = true;
            foreach (i; 1 .. roulette + 1) {
                if (cur + i > n + 1) {
                    graph[cur] ~= n + 1;
                    break;
                }
                int x = next(cur + i);
                graph[cur] ~= x;
                if (!used[x]) make(x);
            }
        }
        make(0);
        foreach (ref g; graph) {
            g = g.sort.uniq.array;
        }
        used[] = false;

        bool cangoal(int cur) {
            if (cur == n + 1) return true;
            used[cur] = true;
            foreach (x; graph[cur]) {
                if (used[x]) continue;
                if (cangoal(x)) return true;
            }
            return false;
        }

        //graph.writeln;

        foreach (int i, ref g; graph) {
            if (g.empty) continue;
            used[] = false;
            if (cangoal(i)) continue;
            writeln("NG");
            continue test;
        }
        writeln("OK");
    }
}