#include <bits/stdc++.h>
using namespace std;
vector<long long> p;
bool visited[1000001];
map<long long, long long> M;
int main() {
  long long n;
  cin >> n;
  long long a[n + 1];
  for (long long i = 1; i <= n; i++) cin >> a[i];
  vector<pair<long long, long long> > v;
  long long f = 1;
  for (long long i = 1; i <= n; i++) {
    if (M[a[i]] == 0) {
      M[a[i]] = i;
    } else {
      if (v.size() == 0) {
        v.push_back({1, i});
      } else
        v.push_back({v[v.size() - 1].second + 1, i});
      M.clear();
    }
  }
  if (v.size() == 0) {
    cout << -1 << endl;
    return 0;
  }
  cout << v.size() << endl;
  for (long long i = 0; i < v.size(); i++) {
    if (i < v.size() - 1)
      cout << v[i].first << " " << v[i].second << endl;
    else {
      cout << v[i].first << " " << n << endl;
    }
  }
}
