#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long a[n];
  vector<pair<long long, long long> > v;
  long long s = 0;
  map<long long, long long> m;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (m[a[i]] > 0) {
      m.clear();
      v.push_back({s, i});
      s = i + 1;
    } else {
      m[a[i]]++;
    }
  }
  if (v.size() == 0) {
    cout << -1;
    return 0;
  }
  if (m.size() > 0) {
    v[v.size() - 1].second = n - 1;
  }
  cout << v.size() << "\n";
  for (long long i = 0; i < v.size(); i++) {
    cout << v[i].first + 1 << " " << v[i].second + 1 << "\n";
  }
}
