#include <bits/stdc++.h>
const int MAX = 300001;
using namespace std;
int p[MAX];
int main() {
  std::ios::sync_with_stdio(false);
  set<int> s;
  int n, m, j;
  while (cin >> n) {
    j = 0;
    p[0] = 0;
    for (int i = 1; i < n + 1; i++) {
      cin >> m;
      if (s.count(m)) {
        s.clear();
        p[j++] = i;
      } else
        s.insert(m);
    }
    if (!j)
      cout << "-1" << endl;
    else {
      p[j - 1] = n;
      cout << j << endl;
      cout << "1"
           << " " << p[0] << endl;
      for (int i = 1; i < j; i++) {
        cout << p[i - 1] + 1 << " " << p[i] << endl;
      }
    }
  }
}
