#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int n, m;
vector<pair<int, int>> x;
int main() {
  cin >> n >> m;
  for (int i = 0; i < (int)(m); i++) {
    int a, b;
    cin >> a >> b;
    for (int j = a; j <= b; j++) x.push_back(make_pair(j, i));
  }
  sort(x.begin(), x.end());
  if (x[0].first != 1) cout << "1 0", exit(0);
  for (int i = 0; i < (int)(x.size() - 1); i++) {
    if (x[i].first + 1 < x[i + 1].first)
      cout << x[i].first + 1 << " 0", exit(0);
    if (x[i].first == x[i + 1].first) {
      int k = 1;
      while (x[i].first == x[i + 1].first) {
        k++;
        i++;
        if (i == x.size() - 1) break;
      }
      cout << x[i - 1].first << " " << k, exit(0);
    }
  }
  if (x[x.size() - 1].first == n)
    cout << "OK";
  else
    cout << x[x.size() - 1].first + 1 << " 0";
  return 0;
}
