#include <bits/stdc++.h>
using namespace std;
const int MAX = 1000000;
struct s {
  int l, r;
} a[MAX];
int n;
map<long long, int> mp;
int main() {
  scanf("%d", &n);
  mp.clear();
  long long t;
  int sum = 0;
  int left = 1;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &t);
    mp[t]++;
    if (mp[t] == 2) {
      a[sum].l = left;
      a[sum].r = i;
      sum++;
      left = i + 1;
      mp.clear();
    } else
      mp[t] = 1;
  }
  if (a[sum - 1].r < n) a[sum - 1].r = n;
  if (sum > 0) {
    printf("%d\n", sum);
    for (int i = 0; i < sum; i++) {
      printf("%d %d\n", a[i].l, a[i].r);
    }
  } else
    printf("-1\n");
  return 0;
}
