#include <bits/stdc++.h>
using namespace std;
int ans, res[300005], prv;
map<int, int> occ;
int main() {
  int n, i, v;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &v);
    if (occ[v] > prv) {
      res[ans++] = i;
      prv = i;
    } else
      occ[v] = i;
  }
  if (!ans)
    puts("-1");
  else {
    res[ans - 1] = n;
    printf("%d\n1 %d\n", ans, res[0]);
    for (i = 1; i < ans; i++) printf("%d %d\n", res[i - 1] + 1, res[i]);
  }
}
