#include "bits/stdc++.h"
using namespace std;

using int64 = long long;

template<typename T>
using p_que = priority_queue<T>;
template<typename T>
using rp_que = priority_queue<T, vector<T>, greater<T>>;

constexpr int INF = (1 << 30) - 1;
constexpr int64 INF64 = (1ll << 60) - 1;

#define rep(i, N) for(int i=0;i<(int)(N);++i)
#define fs first
#define sc second
#define e_b emplace_back
#define m_p make_pair
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()

template <typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	return os << "P(" << p.first << ", " << p.second << ")";
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "[";
	for (auto& e : v) os << e << ", ";
	return os << "]";
}
template <typename T, typename U>
ostream& operator<<(ostream& os, const map<T, U>& m) {
	os << "{" << endl;
	for (auto& e : m) os << "(" << e.first << ", " << e.second << ")" << endl;
	return os << "}";
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& s) {
	os << "{" << endl;
	for (auto& e : s) os << ", " << e << endl;
	return os << "}";
}

template<typename T>
vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int64 gcd(int64 x, int64 y) {
	if (x == 0 || y == 0) return 0;
	int64 r;
	while ((r = y % x) != 0) {
		y = x;
		x = r;
	}
	return x;
}
int64 lcm(int64 x, int64 y) {
	if (x == 0 || y == 0) return 0;
	return x / gcd(x, y) * y;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = { 0, 1, 0, -1 };

void Main();
signed main() {
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	Main();
}

/*----------------------------Insert from here!----------------------------*/

template <int mod>
struct ModInt {
	int x;

	ModInt() : x(0) {}

	ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

	ModInt& operator+=(const ModInt& p) {
		if ((x += p.x) >= mod) x -= mod;
		return *this;
	}

	ModInt& operator-=(const ModInt& p) {
		if ((x += mod - p.x) >= mod) x -= mod;
		return *this;
	}

	ModInt& operator*=(const ModInt& p) {
		x = (int)(1LL * x * p.x % mod);
		return *this;
	}

	ModInt& operator/=(const ModInt& p) {
		*this *= p.inverse();
		return *this;
	}

	ModInt operator-() const { return ModInt(-x); }

	ModInt operator+(const ModInt& p) const { return ModInt(*this) += p; }

	ModInt operator-(const ModInt& p) const { return ModInt(*this) -= p; }

	ModInt operator*(const ModInt& p) const { return ModInt(*this) *= p; }

	ModInt operator/(const ModInt& p) const { return ModInt(*this) /= p; }

	bool operator==(const ModInt& p) const { return x == p.x; }

	bool operator!=(const ModInt& p) const { return x != p.x; }

	ModInt inverse() const {
		int a = x, b = mod, u = 1, v = 0, t;
		while (b > 0) {
			t = a / b;
			swap(a -= t * b, b);
			swap(u -= t * v, v);
		}
		return ModInt(u);
	}

	ModInt pow(int64_t n) const {
		ModInt ret(1), mul(x);
		while (n > 0) {
			if (n & 1) ret *= mul;
			mul *= mul;
			n >>= 1;
		}
		return ret;
	}

	friend ostream& operator<<(ostream& os, const ModInt& p) {
		return os << p.x;
	}

	friend istream& operator>>(istream& is, ModInt& a) {
		int64_t t;
		is >> t;
		a = ModInt< mod >(t);
		return (is);
	}

	static int get_mod() { return mod; }
};

template <typename T>
struct Edge {
	int from, to;
	T cost;

	Edge() : from(0), to(0), cost(0) {}
	Edge(int to, T cost) : from(-1), to(to), cost(cost) {}
	Edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
	Edge& operator=(const int& x) {
		to = x;
		return *this;
	}
};

template <typename T>
using Edges = vector<Edge<T>>;
template <typename T>
using wGraph = vector<Edges<T>>;

/* Function from here! */

template <typename T>
vector<T> dijkstra(wGraph<T>& g, int s) {
	const auto INF = numeric_limits<T>::max();
	vector<T> dist(g.size(), INF);

	using P = pair<T, int>;
	priority_queue<P, vector<P>, greater<P>> que;
	dist[s] = 0;
	que.emplace(dist[s], s);
	while (!que.empty()) {
		T cost;
		int idx;
		tie(cost, idx) = que.top();
		que.pop();
		if (dist[idx] < cost) continue;
		for (auto& e : g[idx]) {
			T next_cost = cost + e.cost;
			if (dist[e.to] <= next_cost) continue;
			dist[e.to] = next_cost;
			que.emplace(dist[e.to], e.to);
		}
	}

	return dist;
}

/*----------------------------Insert above here----------------------------*/

void Main() {
	int max, n;
	while (true) {
		cin >> max;
		if (max == 0) break;
		cin >> n;

		vector<int> d(n + 2);
		for (int i = 1; i <= n; ++i) cin >> d[i];

		wGraph<int> G(n + 2);
		vector<int> used(n + 2);
		stack<int> stk;
		stk.emplace(0);
		while (!stk.empty()) {
			int idx = stk.top(); stk.pop();
			if (used[idx]) continue;
			used[idx] = 1;
			for (int i = 1; i <= max; ++i) {
				int next = idx + i;
				if (next >= n + 2) break;
				next += d[next];
				if (next >= n + 2) next = n + 1;
				else if (next < 0) next = 0;
				G[idx].emplace_back(next, 1);

				if (used[next]) continue;
				stk.emplace(next);
			}
		}

		/*
		for(int i=0; i<n+1; ++i) {
			cout << i << " ";
			for (auto& k : G[i]) cout << k.to << " ";
			cout << endl;
		}
		*/

		for (int i = 0; i < n + 1; ++i) {
			if (!used[i]) continue;
			auto d = dijkstra(G, i);
			if (d[n + 1] == numeric_limits<int>::max()) {
				cout << "NG" << endl;
				goto LABEL;
			}
		}
		cout << "OK" << endl;
	LABEL:
		;
	}
}


Measured memory_bytes: 3216