#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const double pi = acos(-1);
map<int, int> p;
int a[300010], l[300010], r[300010];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int ans = 0;
  l[ans] = 1;
  p[a[1]]++;
  for (int i = 2; i <= n; i++) {
    if (p[a[i]]) {
      r[ans] = i;
      l[++ans] = i + 1;
      p.clear();
    } else
      p[a[i]]++;
  }
  if (ans == 0)
    puts("-1");
  else {
    if (r[ans - 1] != n) r[ans - 1] = n;
    printf("%d\n", ans);
    for (int i = 0; i < ans; i++) {
      printf("%d %d\n", l[i], r[i]);
    }
  }
}
