#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, r;
  long long a;
  map<int, long long> d;
  int ans[300010];
  int k = 0;
  ans[0] = 1;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    scanf("%I64d", &a);
    if (d[a] > r) {
      ans[++k] = i;
      r = i;
    } else
      d[a] = i;
  }
  if (k) {
    printf("%i\n%i", k, ans[0]);
    for (int i = 1; i < k; ++i) printf(" %i\n%i", ans[i], ans[i] + 1);
    printf(" %i", n);
  } else
    cout << -1;
  return 0;
}
