#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  set<int> used;
  int last, n, cur, k;
  vector<pair<int, int> > ans;
  k = 0;
  last = 1;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> cur;
    if (used.find(cur) != used.end()) {
      k++;
      used.clear();
      ans.push_back(make_pair(last, i + 1));
      last = i + 2;
    } else {
      used.insert(cur);
    }
  }
  if (k) {
    cout << k << '\n';
    for (int i = 0; i < k; i++) {
      ans[k - 1].second = n;
      cout << ans[i].first << " " << ans[i].second << '\n';
    }
  } else
    cout << -1;
  return 0;
}
