#include <bits/stdc++.h>
using namespace std;
int a[300010];
vector<pair<int, int> > r(300010);
map<int, int> mp;
int main() {
  cin.tie(NULL);
  int n;
  scanf("%d", &n);
  int i, sz = 0, start;
  for (i = 0; i < n; i++) {
    scanf("%d", (a + i));
  }
  mp[a[0]]++;
  start = 0;
  for (i = 1; i < n; i++) {
    mp[a[i]]++;
    if (mp[a[i]] == 2) {
      r[sz++] = (make_pair(start + 1, i + 1));
      start = i + 1;
      mp.clear();
    }
  }
  if (sz == 0)
    cout << -1 << endl;
  else {
    r[sz - 1].second = n;
    cout << sz << endl;
    for (i = 0; i < sz; i++) {
      printf("%d %d\n", r[i].first, r[i].second);
    }
  }
  return 0;
}
