#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

#define reps(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reps(i,0,n)


vector<bool> cnt(vvi G, int start)
{
    vector<bool> visited(G.size(), false);
    queue<int> Q;
    Q.push(start);
    
    while(!Q.empty()){
        int p = Q.front();
        Q.pop();
        if(visited[p]) continue;
        visited[p] = true;
        for(int e : G[p]){
            Q.push(e);
        }
    }
    
    return visited;
}


int func(int m)
{
    int n;
    cin >> n;
    
    vvi G1(n+2), G2(n+2);
    vi d(n+m);
    rep(i, n){
        cin >> d[i];
    }
    
    rep(i, n+1){
        rep(j, m){
            int v = i + j + 1 + d[i+j];
            if(0 <= v && v < n+2){
                G1[i].push_back(v);
                G2[v].push_back(i);
            }
        }
    }
    
    vector<bool> a = cnt(G1, 0), b = cnt(G2, n+1);
    rep(i, n+2){
        if(a[i] && !b[i]) return false;
    }
    return true;
}

int main()
{
    int m;
    while(cin >> m, m){
        cout << (func(m) ? "OK" : "NG") << endl;
    }
}