#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  long long int n;
  cin >> n;
  long long int arr[n + 2];
  for (int i = 1; i <= n; i++) cin >> arr[i];
  int i = 1;
  vector<pair<long long, long long> > ans;
  while (i <= n) {
    int j = i + 1;
    map<long long int, long long int> mp;
    mp[arr[i]]++;
    long long int ma = 1;
    while (j <= n) {
      mp[arr[j]]++;
      ma = max(ma, mp[arr[j]]);
      if (ma == 2) {
        break;
      }
      j++;
    }
    if (ma == 2) ans.push_back(make_pair(i, j));
    i = j + 1;
  }
  if (ans.size() == 0) return cout << -1 << endl, 0;
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    if (i == ans.size() - 1)
      cout << ans[i].first << " " << n << endl;
    else
      cout << ans[i].first << " " << ans[i].second << endl;
  }
  return 0;
}
