#include <bits/stdc++.h>
const int mx = 1e6 + 5;
const int inf = 0x3f3f3f3f;
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  scanf("%d", &n);
  vector<int> v(n);
  for (int i = 0; i < n; ++i) scanf("%d", &v[i]);
  set<int> s;
  vector<pair<int, int> > pairs;
  int b = 0;
  for (int i = 0; i < n; ++i) {
    if (s.find(v[i]) != s.end()) {
      pairs.push_back({b + 1, i + 1});
      b = i + 1;
      s.clear();
      continue;
    }
    s.insert(v[i]);
  }
  if (!pairs.size()) {
    puts("-1");
    return 0;
  }
  pairs.back().second = n;
  printf("%d\n", int(pairs.size()));
  for (int i = 0; i < pairs.size(); ++i)
    printf("%d %d\n", pairs[i].first, pairs[i].second);
  return 0;
}
