let input = require('fs').readFileSync('/dev/stdin', 'utf8');
let d = (input.trim()).split("\n");

while(1){
   let t = d.shift() - 0;
   if (t == 0) break;
   
   let n = d.shift() - 0;
   let sum = 0;
   for(i = 0;i < n;++i){
      var arr = (d.shift()).split(" ").map(Number);
      sum += arr[1] - arr[0];
   }
   ans = t <= sum ? "OK" : t - sum;
   console.log(ans);
}
