#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
bool compare(T x, U y) {
  return (abs(x - y) <= 1e-9);
}
const int MOD = 1e9 + 7;
void solve() {
  int n, m;
  cin >> n >> m;
  vector<pair<int, int> > v(m);
  for (auto &x : v) cin >> x.first >> x.second;
  int st = v[0].first, end = v[0].second;
  if (st != 1) {
    cout << 1 << " " << 0;
    return;
  }
  for (int i = 1; i < m; i++) {
    if (v[i].first == end) {
      int cnt = 2;
      for (int j = i + 1; j < m; j++)
        if (end == v[j].first) cnt++;
      cout << end << " " << cnt;
      return;
    } else {
      if (v[i].first - end > 1) {
        cout << end + 1 << " " << 0;
        return;
      }
    }
    end = v[i].second;
  }
  if (end < n)
    cout << n << " " << 0;
  else
    cout << "OK";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
}
