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