#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
set<int> s;
int x[maxn];
int n, k;
int main() {
  while (~scanf("%d", &n)) {
    k = 0;
    if (!s.empty()) s.clear();
    for (int i = 1; i <= n; i++) {
      int p;
      scanf("%d", &p);
      if (s.count(p) == 0)
        s.insert(p);
      else {
        x[k++] = i;
        s.clear();
      }
    }
    if (k == 0)
      printf("-1\n");
    else {
      if (x[k - 1] != n) x[k - 1] = n;
      printf("%d\n", k);
      printf("1 %d\n", x[0]);
      for (int i = 0; i < k - 1; i++) printf("%d %d\n", x[i] + 1, x[i + 1]);
    }
  }
  return 0;
}
