#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
  int M, N;
  while(cin>>M>>N){
    vector<int> d(N + 2); //0 - start, N + 1 - goal
    REP(i, N) cin>>d[i + 1];
    vector<bool> is_ok(N + 2);
    queue<int> que;
    is_ok[N + 1] = true;
    que.push(N + 1);
    while(!que.empty()){
      int u = que.front(); que.pop();
      REP(v, N + 2)if(v + d[v] == u || (u == N + 1 && v + d[v] >= u)){
        for(int c = 1; c <= M && v - c >= 0; c++) if(!is_ok[v - c]){
          que.push(v - c);
          is_ok[v - c] = true;
        }
      }
    }
    bool ans = true;
    vector<bool> used(N + 2);
    que.push(0);
    used[0] = true;
    while(!que.empty()){
      int u = que.front(); que.pop();
      if(!is_ok[u]) ans = false;
      for(int c = 1; c <= M && u + c < N + 2; c++){
        int v = u + c;
        int to = v + d[v];
        if(to < 0) to = 0;
        if(to > N + 1) to = N + 1;
        if(used[to]) continue;
        que.push(to);
        used[to] = true;
      }
    }
    if(ans) cout<<"OK"<<endl;
    else cout<<"NG"<<endl;
  }
  return 0;
}