#include <bits/stdc++.h>
using namespace std;
int a[333333];
map<int, bool> di;
vector<pair<int, int> > ans;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  int l = 0;
  for (int i = 0; i < n; i++) {
    if (di.find(a[i]) != di.end()) {
      di.clear();
      ans.push_back(make_pair(l + 1, i + 1));
      l = i + 1;
    } else
      di[a[i]] = 1;
  }
  int t = ans.size();
  if (!t) {
    printf("-1\n");
    return 0;
  }
  printf("%d\n", ans.size());
  for (int i = 0; i < t - 1; i++)
    printf("%d %d\n", ans[i].first, ans[i].second);
  printf("%d %d\n", ans[t - 1].first, max(ans[t - 1].second, n));
  return 0;
}
