#include <bits/stdc++.h>
using namespace std;
struct {
  long x;
  long y;
  void set(long xx, long yy) {
    x = xx;
    y = yy;
  }
} A[3 * 100 * 1000 + 5];
long na = 0;
int main() {
  long n;
  scanf("%ld", &n);
  long x, y;
  set<long> s;
  long tmp;
  x = 1;
  A[na].x = 1;
  for (long i = 1; i <= n; i++) {
    scanf("%ld", &tmp);
    if (s.count(tmp) == 0) {
      s.insert(tmp);
    } else {
      A[na].y = i;
      na++;
      A[na].x = i + 1;
      s.clear();
    }
  }
  if (na == 0) {
    cout << -1;
    return 0;
  }
  A[na - 1].y = n;
  cout << na << endl;
  for (long i = 0; i < na; i++) {
    cout << A[i].x << " " << A[i].y << endl;
  }
  return 0;
}
