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