#include <bits/stdc++.h>
using namespace std;
int inp[300010];
set<int> second;
vector<int> V;
int main() {
  int n, i, res = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", inp + i);
  }
  V.push_back(0);
  for (i = 0; i < n; i++) {
    if (second.find(inp[i]) != second.end()) {
      res++;
      V.push_back(i + 1);
      second.clear();
      continue;
    }
    second.insert(inp[i]);
  }
  if (res == 0) {
    printf("-1");
    return 0;
  }
  if (V.back() != n)
    ;
  { V.back() = n; }
  printf("%d\n", res);
  for (i = 0; i < V.size() - 1; i++) {
    printf("%d %d\n", V[i] + 1, V[i + 1]);
  }
}
