#include<iostream>
#include<queue>
using namespace std;

bool solve(int mx, int n, int order[])
{
	queue<int> search;
	queue<int> back[252];

	int start[252];
	for (int i = 0; i <= n + 1; i++) start[i] = false;
	start[0] = true;
	search.push(0);
	while (!search.empty()){
		int now = search.front();
		search.pop();
		for (int i = 1; i <= mx; i++){
			int next;
			if (now + i <= 0) continue;
			else if (now + i > n + 1) next = n + 1;
			else if (now + i + order[now + i] <= 0) continue;
			else if (now + i + order[now + i] > n + 1) next = n + 1;
			else next = now + i + order[now + i];
			back[next].push(now);
			if (start[next]) continue;
			start[next] = true;
			search.push(next);			
		}
	}
	if (!start[n + 1]) return false;
	
	int goal[252];
	for (int i = 0; i <= n + 1; i++) goal[i] = false;
	goal[n + 1] = true;	
	search.push(n + 1);
	while (!search.empty()){
		int now = search.front();
		search.pop();
		while (!back[now].empty()){
			int from = back[now].front();
			back[now].pop();
			if (goal[from]) continue;
			goal[from] = true;
			search.push(from);
		}
	}
	for (int i = 0; i <= n + 1; i++){
		if (start[i] && !goal[i]) return false;
	}
	return true;
}

int main()
{
	while (true){
		int mx;
		cin >> mx;
		if (!mx) break;
		int n, order[252];
		cin >> n;
		order[0] = order[n + 1] = 0;
		for (int i = 1; i <= n; i++){
			cin >> order[i];
		}
		if (solve(mx, n, order)) cout << "OK" << endl;
		else cout << "NG" << endl;
	}
	return 0;
}