import scala.annotation.tailrec
import scala.collection.mutable
import scala.io.StdIn._
object Main extends App {

  loop
  @tailrec
  def loop: Unit = {
    val max = readInt
    if (max == 0) return
    val n = readInt
    val cell = 0 +: Array.tabulate(n){i ⇒
      val d = readInt
      if (d + i + 1 > n + 1) n + 1
      else if (d + i + 1 < 0) 0
      else d + i + 1
    } :+ n + 1
    val canReachFrom = Array.tabulate(n + 2){_ ⇒ Nil: List[Int]}
    val canStop = Array.tabulate(n + 2){_ ⇒ false}
    canStop(0) = true
    val queue = mutable.Queue[Int](0)
    while(queue.nonEmpty){
      val current = queue.dequeue()
      for (i ← current + 1 to math.min(n + 1, current + max)){
        canReachFrom(cell(i)) ::= current
        if (!canStop(cell(i))) {
          canStop(cell(i)) = true
          queue.enqueue(cell(i))
        }
      }
    }
    for (i ← canStop.indices) canStop(i) = false
    canStop(n + 1) = true
    queue.enqueue(n + 1)
    while (queue.nonEmpty){
      val current = queue.dequeue()
      for (i ← canReachFrom(current) if !canStop(i)) {
        canStop(i) = true
        queue.enqueue(i)
      }
    }
    println(
      if (canStop.indices.forall(i ⇒ canStop(i) || canReachFrom(i).isEmpty)) "OK" else "NG"
    )
    loop
  }
}

