#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  map<long long, long long> k;
  long long l = 0, r;
  long long c = 0;
  vector<pair<long long, long long>> ans;
  for (long long i = 0; i < n; i++) {
    k[a[i]]++;
    if (k[a[i]] == 2) {
      r = i;
      ans.push_back(make_pair(l + 1, r + 1));
      k.clear();
      l = i + 1;
    }
  }
  if (ans.size() == 0) {
    cout << -1 << endl;
  } else {
    cout << ans.size() << endl;
    for (long long i = 0; i < ans.size(); i++) {
      if (i == ans.size() - 1) {
        cout << ans[i].first << " " << n << endl;
      } else
        cout << ans[i].first << " " << ans[i].second << endl;
    }
  }
  return 0;
}
