#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > s;
map<int, bool> m;
int main() {
  int x, cit, r = 0, st = 1;
  scanf("%d", &x);
  for (int i = 1; i <= x; i++) {
    scanf("%d", &cit);
    if (m[cit] == 1) {
      s.push_back({st, i});
      m.clear();
      st = i + 1;
      r++;
    } else {
      m[cit] = 1;
    }
  }
  if (r == 0) {
    printf("-1");
    return 0;
  }
  printf("%d\n", r);
  for (int i = 0; i < s.size() - 1; i++) {
    printf("%d %d\n", s[i].first, s[i].second);
  }
  printf("%d %d", s[s.size() - 1].first, x);
  return 0;
}
