#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  vector<pair<int, int> > v;
  long long n, i, a;
  cin >> n;
  int s = 1, e;
  set<int> m;
  for (i = 0; i < n; i++) {
    cin >> a;
    if (m.count(a) > 0) {
      e = i + 1;
      v.push_back(make_pair(s, e));
      s = e + 1;
      m.clear();
    } else
      m.insert(a);
  }
  if (v.size() > 0 && e != n) (v[v.size() - 1]).second = n;
  if (v.size() == 0) {
    cout << -1 << endl;
    return 0;
  }
  cout << v.size() << endl;
  for (auto it = v.begin(); it != v.end(); it++)
    cout << (*it).first << " " << (*it).second << endl;
}
