#include <bits/stdc++.h>
using namespace std;
map<long long, bool> pernah;
int n, input, hasil = 0;
vector<int> ada;
queue<int> jawaban;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &input);
    if (pernah[input]) {
      hasil++;
      jawaban.push(i);
      while (!ada.empty()) {
        pernah[ada.back()] = false;
        ada.pop_back();
      }
    } else {
      pernah[input] = true;
      ada.push_back(input);
    }
  }
  if (hasil == 0)
    printf("-1\n");
  else {
    int index = 1;
    printf("%d\n", hasil);
    jawaban.back() = n;
    while (!jawaban.empty()) {
      printf("%d %d\n", index, jawaban.front());
      index = jawaban.front() + 1;
      jawaban.pop();
    }
  }
}
