#include <bits/stdc++.h>
using namespace std;
map<long long int, int> my;
long long int arr[400000];
int main() {
  int n, i, l, r, cnt;
  scanf("%d", &n);
  pair<int, int> p[n + 10];
  for (i = 1; i <= n; i++) {
    scanf("%i64d", &arr[i]);
  }
  l = 1;
  r = 1;
  cnt = 1;
  bool f = 0;
  for (i = 1; i <= n; i++) {
    f = 0;
    if (my[arr[i]] == 0) {
      my[arr[i]] = i;
    } else {
      p[cnt].first = l;
      p[cnt].second = i;
      l = i + 1;
      cnt++;
      my.clear();
      f = 1;
    }
  }
  if (f == 0) {
    p[cnt - 1].second = n;
  }
  if (cnt == 1) {
    printf("-1\n");
    return 0;
  }
  printf("%d\n", cnt - 1);
  for (i = 1; i < cnt; i++) {
    printf("%d %d\n", p[i].first, p[i].second);
  }
}
