#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, start, i, x;
  set<int> myset;
  vector<pair<int, int> > v;
  cin >> n;
  start = 0;
  for (i = 0; i < n; i++) {
    cin >> x;
    if (myset.find(x) == myset.end()) {
      myset.insert(x);
    } else {
      v.push_back(make_pair(start + 1, i + 1));
      start = i + 1;
      myset.clear();
    }
  }
  if (v.size() == 0)
    cout << "-1";
  else {
    v[v.size() - 1].second = n;
    cout << v.size() << endl;
    for (i = 0; i < v.size(); i++) {
      cout << v[i].first << " " << v[i].second << endl;
    }
  }
  return 0;
}
