#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> dias(n, 0);
  int partir = sqrt(n);
  vector<int> particions((n + partir - 1) / partir, 0);
  while (m--) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    dias[a]++;
    a++;
    while (a % partir != 0 and a <= b) {
      dias[a]++;
      a++;
    }
    if (a <= b) {
      while (a <= b) {
        particions[a / partir]++;
        a += partir;
      }
      a -= partir;
      particions[a / partir]--;
      while (a <= b) {
        dias[a]++;
        a++;
      }
    }
  }
  bool petao = false;
  for (int i = 0; i < n and not petao; i++) {
    if (dias[i] + particions[i / partir] != 1) {
      petao = true;
      cout << i + 1 << " " << dias[i] + particions[i / partir] << '\n';
    }
  }
  if (not petao) cout << "OK" << '\n';
}
