import scala.io.StdIn.{readInt,readLine}

object Main {
  def main(args:Array[String]) = {
    var n = 0
    while( {n=readInt;n} != 0 ) {
      val sum = {
        for(i<-1 to readInt) yield {
        val s = readLine.split(" ").map(_.toInt)
        s(1)-s(0)
        }
      }.sum
      if(sum >= n) println("OK")
      else println(n-sum)
    }
  }
}