#include <bits/stdc++.h>
using namespace std;
signed main() {
  vector<pair<long long int, long long int> > v;
  long long int n, m, a, b, k, z, cnt = 0, q, f = 0, g = 0;
  cin >> n >> m;
  for (long long int i = 0; i < m; i++) {
    cin >> a >> b;
    v.push_back({a, b});
  }
  if (v[0].first != 1) {
    cout << 1 << " " << 0;
    g = 1;
  } else if (m == 1) {
    if (v[0].first == 1 && v[0].second == n) {
      cout << "OK";
      g = 1;
    } else if (v[0].first == 1) {
      g = 1;
      cout << v[0].second + 1 << " " << 0;
    } else {
      cout << 1 << " " << 0;
      g = 1;
    }
  }
  if (g == 0) {
    for (long long int i = 0; i < m - 1; i++) {
      if (v[i + 1].first == v[i].second) {
        cnt = 2;
        f = 1;
        k = v[i].second;
        z = i;
        while (z < m) {
          z++;
          if (v[z + 1].first == k) cnt++;
        }
        cout << k << " " << cnt;
        break;
      } else if ((v[i + 1].first - v[i].second) > 1) {
        f = 1;
        cout << v[i].second + 1 << " " << 0;
        break;
      }
    }
    if (f == 0) {
      if (v[m - 1].second < n)
        cout << v[m - 1].second + 1 << " " << 0;
      else if (f == 0)
        cout << "OK";
    }
  }
}
