#include <bits/stdc++.h>
using namespace std;
const int nsz = 3e5;
int n, a[nsz + 5];
vector<pair<int, int> > ans;
map<int, int> cnt;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
  }
  int fm = 1;
  for (int i = 1; i <= n; ++i) {
    ++cnt[a[i]];
    if (cnt[a[i]] == 2) {
      cnt.clear();
      ans.push_back(make_pair(fm, i));
      fm = i + 1;
    }
  }
  if (!ans.size()) {
    cout << -1 << '\n';
    return 0;
  }
  ans.back().second = n;
  cout << ans.size() << '\n';
  for (__typeof(ans.begin()) it = ans.begin(); it != ans.end(); ++it) {
    cout << it->first << ' ' << it->second << '\n';
  }
}
