#include <bits/stdc++.h>
using namespace std;
long long a, x = 0, l = 1, r = 0, n;
vector<pair<int, int> > v;
set<int> s;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    if (s.find(a) != s.end()) {
      x++;
      r = i;
      v.push_back({l, r});
      l = r + 1;
      while (!s.empty()) s.erase(s.begin());
    } else
      s.insert(a);
  }
  if (x == 0) {
    cout << -1;
    return 0;
  }
  cout << x << '\n';
  for (int i = 0; i < v.size(); i++) {
    if (i == v.size() - 1 && v[i].second != n) {
      v[i].second = n;
    }
    cout << v[i].first << ' ' << v[i].second << '\n';
  }
  return 0;
}
