#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> v(n);
  for (int((i)) = (0); ((i)) < ((n)); ((i))++) scanf("%d", &(v[i]));
  set<int> s;
  vector<pair<int, int> > ans;
  int l = 0;
  for (int((i)) = (0); ((i)) < ((n)); ((i))++) {
    if (s.count(v[i])) {
      ans.push_back(make_pair(l, i));
      s.clear();
      l = i + 1;
      continue;
    }
    s.insert(v[i]);
  }
  if (ans.size() == 0) {
    cout << -1 << endl;
    return 0;
  }
  printf("%d\n", ans.size());
  for (int((i)) = (0); ((i)) < ((ans.size() - 1)); ((i))++) {
    printf("%d %d\n", ans[i].first + 1, ans[i].second + 1);
  }
  printf("%d %d\n", ans.back().first + 1, n);
}
