#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cctype>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>

using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 999999
#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<k;i++)
typedef long long ll;
typedef unsigned long long ull;

int main(){
    int ma;
    while(scanf("%d",&ma),ma){
        int n;
        scanf("%d",&n);
        int stage[256]={0};
        bool D[300][300]={{0}};
        reps(i,1,n+1)scanf("%d",&stage[i]);
        rep(i,n+1){
            reps(j,1,ma+1){
                /*行先i+j*/
                if(stage[i+j]==0)D[i][i+j]=1;
                else if(stage[i+j]>=1)D[i][min(i+j+stage[i+j],n+1)]=1;
                else if(stage[i+j]<=-1)D[i][max(0,i+j+stage[i+j])]=1;
            }
        }
        /*WarshallFloyd*/
        rep(k,n+2){
            rep(i,n+2){
                rep(j,n+2){
                    if(D[i][k] && D[k][j]) D[i][j] = 1;
                }
            }
        }
        bool f = true;

        rep(i,n+1)if(D[0][i] && !D[i][n+1])f =false;
        printf("%s\n",(f) ? "OK" : "NG");
    }
	return 0;
}