#include <bits/stdc++.h>
using namespace std;
int n, m;
map<int, int> M;
int a[300300];
int retx[300300];
int rety[300300];
int main() {
  scanf("%d", &n);
  int l = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    M[a[i]]++;
    if (M[a[i]] == 2) {
      for (int j = l + 1; j <= i; j++) M[a[j]]--;
      m++;
      retx[m] = l + 1;
      rety[m] = i;
      l = i;
    }
  }
  if (m == 0)
    puts("-1");
  else
    printf("%d\n", m);
  if (l < n) rety[m] = n;
  for (int i = 1; i <= m; i++) printf("%d %d\n", retx[i], rety[i]);
  return 0;
}
