#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300005;
int n, x, ans, l[MAXN], r[MAXN], cur;
map<int, int> M;
int main() {
  scanf("%d", &n);
  cur = 1;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &x);
    if (M[x] == 1) {
      ans++;
      l[ans] = cur;
      r[ans] = i;
      cur = i + 1;
      M.clear();
    } else
      M[x] = 1;
  }
  r[ans] = n;
  if (ans == 0) ans = -1;
  printf("%d\n", ans);
  for (int i = 1; i <= ans; ++i) printf("%d %d\n", l[i], r[i]);
  return 0;
}
