#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  ;
  int arr[n + 1], l, r;
  for (int x = 1; x <= n; x++) scanf("%d", &arr[x]);
  ;
  vector<pair<int, int>> res;
  map<int, int> freq;
  l = 1;
  for (int x = 1; x <= n; x++) {
    freq[arr[x]]++;
    if (freq[arr[x]] == 2) {
      res.emplace_back(make_pair(l, x));
      l = x + 1;
      freq.clear();
    }
  }
  if (res.size() == 0) return 0 * printf("-1");
  printf("%d\n", (int)res.size());
  for (int x = 0; x < res.size() - 1; x++)
    printf("%d %d\n", res[x].first, res[x].second);
  printf("%d %d", res[res.size() - 1].first, max(n, res[res.size() - 1].first));
}
