#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  set<int> s;
  int n;
  cin >> n;
  int b = 1;
  int p;
  vector<pair<int, int> > res;
  for (int i = 1; i <= n; i++) {
    cin >> p;
    if (s.find(p) == s.end())
      s.insert(p);
    else {
      res.push_back(make_pair(b, i));
      b = i + 1;
      s.clear();
    }
  }
  cout;
  if (res.size() == 0)
    cout << -1;
  else {
    res.back().second = n;
    cout << res.size() << "\n";
    for (int i = 0; i < res.size(); i++)
      cout << res[i].first << " " << res[i].second << "\n";
  }
}
