#include <bits/stdc++.h>
using namespace std;
long long a[534567], b[534567], c[534567], d, e, zai, i, j, m, k, x, y, z, l, r,
    n, s, t, tt;
string p, q, qq;
map<long long, long long> u, v;
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x;
    if (u[x] > 0) {
      if (s == 0)
        a[s] = 1;
      else
        a[s] = b[s - 1] + 1;
      b[s] = i + 1;
      s++;
      u = v;
    } else
      u[x] = i + 1;
  }
  if (s == 0) {
    cout << -1;
    return 0;
  }
  b[s - 1] = n;
  cout << s << endl;
  for (i = 0; i < s; i++) {
    cout << a[i] << ' ' << b[i] << endl;
  }
  return 0;
}
