#include <bits/stdc++.h>
using namespace std;
int fx[] = {+0, +0, +1, -1, -1, +1, -1, +1};
int fy[] = {-1, +1, +0, +0, +1, +1, -1, -1};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, i, j, k = 1;
  cin >> n;
  long long arr[n + 1];
  for (i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  map<long long, long long> mp;
  vector<pair<long long, long long>> v;
  for (i = 1; i <= n; i++) {
    if (mp[arr[i]] == 0) {
      mp[arr[i]] = 1;
    } else {
      mp.clear();
      v.push_back(make_pair(k, i));
      k = i + 1;
    }
  }
  if (v.size() == 0) {
    cout << -1;
    return 0;
  }
  cout << v.size() << "\n";
  for (i = 0; i < v.size(); i++) {
    if (i == v.size() - 1)
      cout << v[i].first << " " << n << "\n";
    else
      cout << v[i].first << " " << v[i].second << "\n";
  }
  return 0;
}
