#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using pll = pair<ll, ll>;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ll n;
  cin >> n;
  ll arr[n];
  for (ll i = 0; i < n; i++) cin >> arr[i];
  set<ll> dup;
  ll l = 0;
  vector<pll> ans;
  for (ll i = 0; i < n; i++) {
    if (dup.find(arr[i]) == dup.end())
      dup.insert(arr[i]);
    else {
      dup.clear();
      ans.push_back({l + 1, i + 1});
      l = i + 1;
    }
  }
  if (ans.size()) {
    ans[((ll)ans.size()) - 1].second = n;
    cout << ans.size() << "\n";
    for (auto it : ans) cout << it.first << " " << it.second << "\n";
  } else
    cout << "-1\n";
  return 0;
}
