#include <bits/stdc++.h>
using namespace std;
vector<pair<int64_t, int64_t> > vec;
map<int, int> m;
int64_t arr[300005], n, flag, pre, i, j, a, b, s;
int main() {
  flag = 0;
  pre = 1;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> arr[i];
    m[arr[i]]++;
    if (m[arr[i]] == 2) {
      vec.push_back(make_pair(pre, i));
      flag = 1;
      pre = i + 1;
      m.clear();
    }
  }
  if (flag and vec.size() > 1) {
    s = vec.size();
    cout << vec.size() << endl;
    for (i = 0; i < s - 1; i++) {
      a = vec[i].first;
      b = vec[i].second;
      cout << a << " " << b << endl;
    }
    cout << vec[vec.size() - 1].first << " " << n << endl;
    return 0;
  } else if (flag and vec.size() == 1) {
    cout << "1" << endl << "1 " << n << endl;
    return 0;
  } else {
    printf("-1\n");
    return 0;
  }
}
