import Control.Applicative
import Control.Monad

diff :: [Int] -> Int
diff xs = last xs - head xs


solver :: [[Int]] -> Int -> Int
solver xs t = t - sum (map diff xs)


main :: IO()
main = do
  t <- (read :: String -> Int) <$> getLine
  unless (t == 0) $ do
    n <- (read :: String -> Int) <$> getLine
    s <- map (map (read :: String -> Int) . words) <$> replicateM n getLine
    let y = solver s t
    if y <= 0
      then putStrLn "OK"
      else print y
    main