#include <bits/stdc++.h>
using namespace std;
struct perl {
  int start;
  int end;
};
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<perl> ans;
  int i = 0, j = 0;
  while (i < n) {
    set<int> used;
    while (j < n && used.count(a[j]) == 0) {
      used.insert(a[j]);
      j++;
    }
    if (j == n) {
      if (ans.size() == 0) {
        cout << -1;
        return 0;
      } else {
        ans.back().end = n;
      }
    } else {
      perl x;
      x.start = i + 1;
      x.end = j + 1;
      ans.push_back(x);
    }
    j++;
    i = j;
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++)
    cout << ans[i].start << " " << ans[i].end << endl;
  return 0;
}
