#include <bits/stdc++.h>
using namespace std;
int arr[300005];
map<int, int> mp;
vector<int> opt;
int main() {
  int n, lst = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &arr[i]);
    if (mp[arr[i]] && mp[arr[i]] > lst) {
      mp[arr[i]] = 0;
      opt.push_back(++lst);
      opt.push_back(i);
      lst = i;
    } else {
      mp[arr[i]] = i;
    }
  }
  int l = opt.size();
  if (l / 2 == 0) {
    printf("-1\n");
    return 0;
  }
  printf("%d\n", l / 2);
  opt[l - 1] = n;
  for (int i = 0; i < l; i++) {
    printf("%d ", opt[i++]);
    printf("%d\n", opt[i]);
  }
  return 0;
}
