#include <bits/stdc++.h>
using namespace std;
set<int> present;
vector<pair<int, int> > res;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, a;
  cin >> n;
  int p = 1;
  for (int i = 0; i < int(n); i++) {
    cin >> a;
    if (present.find(a) != present.end()) {
      res.push_back(make_pair(p, i + 1));
      p = i + 2;
      present.clear();
      continue;
    }
    present.insert(a);
  }
  if (((int)(res).size()) > 0) {
    res[((int)(res).size()) - 1].second = n;
    cout << ((int)(res).size()) << '\n';
    ;
    for (int i = 0; i < int(((int)(res).size())); i++)
      cout << res[i].first << " " << res[i].second << '\n';
    ;
  } else
    cout << -1 << '\n';
  ;
  return 0;
}
