#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  map<int, int> ma;
  set<int> se;
  int n;
  cin >> n;
  int l, data;
  l = 1;
  int count = 0;
  for (int i = 1; i <= n; i++) {
    cin >> data;
    if (se.find(data) != se.end()) {
      ma[l] = i;
      se.clear();
      l = i + 1;
      count++;
    } else {
      se.insert(data);
    }
  }
  if (count == 0) {
    cout << -1;
  } else {
    map<int, int>::iterator iter;
    iter = ma.end();
    iter--;
    iter->second = n;
    cout << count << endl;
    for (iter = ma.begin(); iter != ma.end(); iter++) {
      cout << iter->first << " " << iter->second << endl;
    }
  }
  return 0;
}
