#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  set<int> S;
  cin >> n;
  vector<pair<int, int> > bra;
  int fans = 0;
  int pend = -1;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    if (S.find(x) != S.end()) {
      bra.push_back(make_pair(pend + 1, i));
      pend = i;
      S.clear();
      continue;
    }
    S.insert(x);
  }
  int sz = (int)bra.size();
  if (!sz) {
    cout << -1 << "\n";
    return 0;
  }
  bra[sz - 1].second = n - 1;
  cout << (int)bra.size() << "\n";
  for (int i = 0; i < bra.size(); ++i) {
    cout << bra[i].first + 1 << " " << bra[i].second + 1 << "\n";
  }
  return 0;
}
