#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  vector<int> a;
  vector<pair<int, int> > ans;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int tmp;
    scanf("%d", &tmp);
    a.push_back(tmp);
  }
  for (int i = 0, j = 0; i < n; i = j) {
    set<int> used;
    while (j < n && used.find(a[j]) == used.end()) {
      used.insert(a[j++]);
    }
    if (j == n) {
      break;
    }
    ans.push_back(make_pair(i + 1, j + 1));
    j++;
  }
  if (ans.size() == 0) {
    puts("-1");
  } else {
    ans.back().second = max(ans.back().second, n);
    printf("%d\n", ans.size());
    for (pair<int, int> p : ans) {
      printf("%d %d\n", p.first, p.second);
    }
  }
}
