#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> vans;
set<int> s;
int main() {
  scanf("%d", &n);
  int start = 1;
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    if (s.count(x)) {
      vans.push_back(start);
      vans.push_back(i);
      start = i + 1;
      s.clear();
    } else {
      s.insert(x);
    }
  }
  if (vans.empty()) {
    printf("-1\n");
    return 0;
  } else {
    printf("%d\n", vans.size() / 2);
    for (int i = 0; i < vans.size() - 2; i += 2)
      printf("%d %d\n", vans[i], vans[i + 1]);
    if (!s.empty())
      printf("%d %d\n", vans[vans.size() - 2], n);
    else
      printf("%d %d\n", vans[vans.size() - 2], vans[vans.size() - 1]);
  }
  return 0;
}
