#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, good_segments = 0, i = 1, count = 0, a_i = 0;
  map<long long, int> pearl_type;
  vector<pair<int, int> > idx;
  scanf("%d", &n);
  int nTmp = n;
  while (n > 0) {
    scanf("%d", &a_i);
    pearl_type[a_i]++;
    count++;
    n--;
    if (pearl_type[a_i] == 2) {
      good_segments++;
      pearl_type.clear();
      idx.push_back(make_pair(i, i + count - 1));
      i = i + count;
      count = 0;
    }
  }
  int t = nTmp - (i - 1);
  if ((nTmp - (i - 1)) != 0 && idx.size() > 0) {
    idx[idx.size() - 1].second += t;
  }
  if (good_segments <= 0) {
    printf("%d\n", -1);
  } else {
    printf("%d\n", good_segments);
    for (unsigned int i = 0; i < idx.size(); i++) {
      printf("%d %d\n", idx[i].first, idx[i].second);
    }
  }
  return 0;
}
