#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int x, y = 1;
  int s, e;
  cin >> s >> e;
  x = e;
  if (s != 1) {
    cout << 1 << " " << 0;
    return 0;
  }
  for (int i = 1; i < m; i++) {
    cin >> s >> e;
    if (s == x && e == x) {
      y++;
      continue;
    } else if (s == x) {
      cout << x << " " << y + 1;
      return 0;
    } else if (s - 1 != x) {
      cout << x + 1 << " " << 0;
      return 0;
    } else {
      x = e;
      y = 1;
    }
  }
  if (y != 1)
    cout << x << " " << y;
  else if (x != n)
    cout << x + 1 << " " << 0;
  else
    cout << "OK";
  return 0;
}
