object Main {
    def main(args:Array[String]) {
        val sc = new java.util.Scanner(System.in)
        while (true) {
            var time = sc.nextInt
            if (time == 0) return
            val n = sc.nextInt
            for (i <- 1 to n) {
                val start, end = sc.nextInt
                time -= (end - start)
            }
            if (time < 0) println("OK")
            else println(time)
        }
    }
}