#include <bits/stdc++.h>
const int INF = INT_MAX;
using namespace std;
const int N = 3e5 + 10;
int arr[N];
int main() {
  ios_base::sync_with_stdio(false);
  stringstream ss;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  map<int, bool> ma;
  vector<pair<int, int> > ans;
  int i = 0, j;
  int start, end;
  bool flag = false;
  while (i < n) {
    j = i;
    start = i;
    ma.clear();
    while (j < n) {
      if (ma.find(arr[j]) == ma.end()) {
        ma[arr[j]] = true;
      } else {
        break;
      }
      j++;
    }
    if (j < n) {
      end = j;
      ans.push_back(make_pair(start, end));
    } else {
      if (ans.size() > 0) {
        ans[ans.size() - 1].second = n - 1;
      } else {
        flag = true;
      }
      break;
    }
    i = j + 1;
  }
  if (flag)
    ss << "-1\n";
  else {
    ss << ans.size() << "\n";
    for (int k = 0, end = ans.size(); k < end; k++) {
      ss << (ans[k].first + 1) << " " << (ans[k].second + 1) << "\n";
    }
  }
  cout << ss.str() << endl;
}
