#include <bits/stdc++.h>
using namespace std;
map<int, int> m;
int main() {
  int n;
  scanf("%d", &n);
  int ans[n / 2 + 1], ans1[n / 2 + 1], p = 0;
  int pr = 0;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    if (m[x] == 0 || m[x] <= pr)
      m[x] = i + 1;
    else if (m[x] != 0) {
      ans[p] = min(pr + 1, m[x]);
      ans1[p++] = i + 1;
      m[x] = 0;
      pr = i + 1;
    }
  }
  if (p == 0)
    printf("-1\n");
  else {
    ans1[p - 1] = max(n, ans1[p - 1]);
    printf("%d\n", p);
    for (int i = 0; i < p; i++) printf("%d %d\n", ans[i], ans1[i]);
  }
  return 0;
}
