#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T> inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

int main() {
    init();

    while (1) {
        int dice;
        cin >> dice;
        if (dice == 0)break;

        int n;
        cin >> n;
        n += 2;
        VI d(n, 0);
        FOR(i, 1, n - 1)cin >> d[i];

        vector<vector<bool>> g(n, vector<bool>(n, false));
        FOR(i, 0, n)g[i][i] = true;
        FOR(i, 0, n) {
            eFOR(j, 1, dice) {
                int next = i + j + d[min(i + j, n - 1) ];
                chmax(next, 0), chmin(next, n - 1);
                g[i][next] = true;
            }
        }
        FOR(k, 0, n)FOR(i, 0, n)FOR(j, 0, n) {
            if (g[i][k] && g[k][j])g[i][j] = true;
        }
        string ans = "OK\n";
        FOR(i, 0, n)if (g[0][i]) {
            if (!g[i][n - 1])ans = "NG\n";
        }
        cout << ans;
    }
    
}
