### main

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

  n = gets.strip.to_i

  sum = 0
  n.times do
    ts, tf = gets.strip.split(' ').map{|s| s.to_i}
    sum += (tf - ts)
  end

  puts (sum >= t ? 'OK' : t - sum)
end