#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, *a, *b, times, i, day;
  while (cin >> n >> m) {
    a = new int[m];
    b = new int[m];
    times = 1;
    for (i = 0; i < m; i++) cin >> a[i] >> b[i];
    for (i = 0; i < m - 1; i++) {
      if (b[i] != a[i + 1] - 1) break;
    }
    if (i + 1 == m && b[i] == n)
      cout << "OK" << endl;
    else {
      if (a[0] != 1) {
        day = 1;
        times--;
      } else if (b[i] == a[i + 1]) {
        day = b[i];
        while (b[i] == a[i + 1] && b[i] == day) {
          times++;
          i++;
        }
      } else {
        day = b[i] + 1;
        times--;
      }
      cout << day << " " << times << endl;
    }
    delete[] a;
    delete[] b;
  }
  return 0;
}
