#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int cnt = 0;
  int a[n + 1];
  for (int i = 0; i < n; i++) cin >> a[i];
  int i = 0, j = 0;
  set<int> val;
  vector<pair<int, int> > ans;
  while (j < n && i < n) {
    if (val.find(a[j]) == val.end()) {
      val.insert(a[j]);
    } else {
      val.clear();
      ans.push_back(make_pair(i + 1, j + 1));
      i = j + 1;
      cnt++;
    }
    j++;
  }
  if (cnt != 0)
    cout << cnt << endl;
  else {
    cout << -1;
    return 0;
  }
  if (ans[ans.size() - 1].second != n) {
    ans[ans.size() - 1].second = n;
  }
  for (auto &i : ans) {
    cout << i.first << " " << i.second << endl;
  }
  return 0;
}
