#include <bits/stdc++.h>
using namespace std;
int a[300020];
set<int> s;
vector<int> v;
int main(void) {
  int n;
  int i;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 1; i <= n; i++)
    if (!s.count(a[i]))
      s.insert(a[i]);
    else {
      s.clear();
      v.push_back(i);
    }
  if (v.empty())
    puts("-1");
  else {
    if (v.at(v.size() - 1) < n) {
      v.pop_back();
      v.push_back(n);
    }
    printf("%d\n", (signed)v.size());
    for (i = 0; i < (signed)v.size(); i++)
      printf("%d %d\n", (i ? v.at(i - 1) : 0) + 1, v.at(i));
  }
  return 0;
}
