#include <bits/stdc++.h>
using namespace std;
map<long long, bool> mmap;
vector<pair<int, int> > segs;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  long long ans = 0;
  int j = 0;
  for (int i = 0; i < n; i++) {
    long long x;
    cin >> x;
    if (mmap[x] == false) {
      mmap[x] = true;
    } else {
      ans++;
      segs.push_back(make_pair(j, i));
      j = i + 1;
      mmap.clear();
    }
  }
  if (ans == 0)
    cout << -1;
  else {
    cout << ans << '\n';
    int len = segs.size();
    if (segs[len - 1].second != n - 1) segs[len - 1].second = n - 1;
    for (int i = 0; i < len; i++)
      cout << segs[i].first + 1 << ' ' << segs[i].second + 1 << '\n';
  }
  return 0;
}
