#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[333333];
  vector<pair<int, int> > res;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  map<int, int> b;
  int l = 0;
  for (int i = 0; i < n; i++) {
    if (b.find(a[i]) != b.end()) {
      res.push_back(make_pair(l + 1, i + 1));
      b.clear();
      l = i + 1;
    } else
      b[a[i]] = i;
  }
  if (res.size() == 0) {
    puts("-1");
  } else {
    printf("%d\n", ((int)(res).size()));
    for (int i = 0; i < ((int)(res).size()) - 1; i++)
      printf("%d %d\n", res[i].first, res[i].second);
    printf("%d %d", res[((int)(res).size()) - 1].first, n);
  }
  return 0;
}
