#include <bits/stdc++.h>
using namespace std;
const long long OO = 1e9;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  map<int, int> mp;
  vector<int> ans;
  for (int i = 0; i < n; i++) {
    if (mp[a[i]]) {
      ans.push_back(i + 1);
      mp.clear();
    } else
      mp[a[i]] = i + 1;
  }
  if (ans.size() == 0) {
    cout << -1 << endl;
    return 0;
  }
  printf("%d\n", (int)ans.size());
  int h = 1;
  for (int i = 0; i < (int)ans.size(); i++) {
    if (i + 1 == ans.size()) ans[i] = n;
    printf("%d %d\n", h, ans[i]);
    h = ans[i] + 1;
  }
}
