#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, beg = 1;
  set<int> has;
  vector<pair<int, int>> ans;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    int v;
    scanf("%d", &v);
    if (has.count(v)) {
      ans.push_back({beg, i});
      beg = i + 1;
      has.clear();
    } else {
      has.insert(v);
    }
  }
  if (ans.empty()) {
    printf("-1\n");
  } else {
    ans.back().second = n;
    printf("%d\n", ans.size());
    for (auto it : ans) {
      printf("%d %d\n", it.first, it.second);
    }
  }
  return 0;
}
