#include <bits/stdc++.h>
using namespace std;
const int INF = 2000000000;
const long double EPS = 1e-6;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  set<int> t;
  int curl = 0;
  vector<pair<int, int> > ans;
  for (int i = 0; i < n; i++) {
    if (t.count(a[i]) != 0) {
      t.clear();
      ans.push_back(make_pair(curl + 1, i + 1));
      curl = i + 1;
    } else {
      t.insert(a[i]);
    }
  }
  if (ans.empty()) {
    cout << "-1\n";
    return 0;
  }
  int m = ans.size();
  ans[m - 1].second = n;
  cout << int(ans.size()) << "\n";
  for (int i = 0; i < int(ans.size()); i++)
    cout << ans[i].first << " " << ans[i].second << "\n";
  return 0;
}
