#include <bits/stdc++.h>
using namespace std;
int num[300005];
map<int, int> p;
int main() {
  int n;
  cin >> n;
  int k;
  int ans = 0, j = 0, l = 1;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &k);
    p[k] += 1;
    if (p[k] == 2) {
      ans++;
      j += 2;
      num[j - 2] = l;
      num[j - 1] = i;
      l = i + 1;
      p.clear();
    }
  }
  if (ans == 0) {
    cout << "-1" << endl;
    return 0;
  }
  num[j - 1] = n;
  cout << ans << endl;
  for (int i = 0; i < j; i += 2) printf("%d %d\n", num[i], num[i + 1]);
  return 0;
}
