#include <bits/stdc++.h>
using namespace std;
int n, m;
int main() {
  int a, b;
  int ans = 0;
  scanf("%d%d", &n, &m);
  bool iss = false;
  int t = -1;
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &a, &b);
    if (iss) {
      if (ans >= a && ans <= b) t++;
      continue;
    }
    if (a > ans + 1) {
      printf("%d 0\n", ans + 1);
      return 0;
    }
    if (a == ans) {
      iss = true;
      t = 2;
      continue;
    }
    ans = b;
  }
  if (t != -1) {
    printf("%d %d\n", ans, t);
  } else {
    if (ans == n) {
      puts("OK");
    } else {
      printf("%d 0\n", ans + 1);
    }
  }
  return 0;
}
