while 1
	sdytime = gets.to_i

	if sdytime == 0
		break
	end

	sdycount = gets.to_i

	set = Array.new()
	times = 0
	1.upto(sdycount) do |i|
		num = gets
		set = num.split(" ")
		times = times + set[1].to_i - set[0].to_i
	end

	if times >= sdytime
		puts "OK"
	else
		puts (sdytime - times)
	end

end