### subroutines

def backtrace(max, n, edges, start)
  visited = (n + 2).times.map{false}

  q = [start]
  visited[start] = true

  while ! q.empty?
    pos = q.shift
    next if pos == 0

    for pos0 in (0..n)
      if edges[pos0][pos] && ! visited[pos0]
        visited[pos0] = true
        q << pos0
      end
    end
  end

  visited
end

### main

while true
  max = gets.strip.to_i
  break if max == 0

  n = gets.strip.to_i

  masu = [0] + n.times.map{gets.strip.to_i}

  edges = (n + 2).times.map{(n + 2).times.map{false}}

  for pos in (0..n)
    for k in (1..max)
      pos0 = pos + k
      pos0 += masu[pos0] if pos0 <= n
      pos0 = 0 if pos0 < 0
      pos0 = n + 1 if pos0 > n

      edges[pos][pos0] = true
    end
  end

  visited = backtrace(max, n, edges, n + 1)

  if ! visited[0]
    puts 'NG'
    next
  end

  ans = 'OK'
  for i in (1..n)
    if ! visited[i]
      visited0 = backtrace(max, n, edges, i)
      if visited0[0]
        ans = 'NG'
        break
      end
    end
  end

  puts ans
end