#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<pair<int, int>> ans;
  map<int, bool> mp;
  int last = 1;
  for (int i = 1; i <= n; i++) {
    int t;
    cin >> t;
    if (mp[t]) {
      ans.push_back({last, i});
      last = i + 1;
      mp.clear();
    } else {
      mp[t] = true;
    }
  }
  if (ans.empty()) {
    cout << "-1\n";
  } else {
    ans.back().second = n;
    cout << ans.size() << '\n';
    for (auto i : ans) {
      cout << i.first << " " << i.second << '\n';
    }
  }
}
