import Control.Monad

main :: IO ()
main = do
  t <- readLn
  if t == 0
    then return ()
    else do
      n <- readLn
      ls <- replicateM n getLine
      let ls' = map (map read . words) ls
      putStrLn $ solve t ls'
      main

solve :: Int -> [[Int]] -> String
--solve t []
--  | t <= 0 = "OK"
--  | otherwise = show t
--solve t ([a,b]:xs)
--  | t <= 0 = "OK"
--  | otherwise = solve (t - (b - a)) xs
solve t ls
  | sumLs >= t = "OK"
  | otherwise = show (t - sumLs)
  where
    sumLs = sumOf ls
    sumOf :: [[Int]] -> Int
    sumOf [] = 0
    sumOf ([a,b]:r) = (b - a) + (sumOf r)