#include <bits/stdc++.h>
using namespace std;
const long long N = 500005;
const long long mod = 1e9 + 7;
void solve() {
  long long x = 0, y = 0, c = 0, ans = 0;
  long long n, m, k;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<vector<long long>> v;
  vector<long long> tem;
  map<long long, long long> mp;
  for (long long i = 0; i < n; ++i) {
    mp[a[i]]++;
    tem.push_back(i + 1);
    if (mp[a[i]] == 2) {
      v.push_back(tem);
      mp.clear();
      tem.clear();
    }
  }
  if ((long long)(v.size()) == 0) {
    cout << -1 << "\n";
    return;
    ;
  }
  if ((long long)(tem.size())) v.back().push_back(tem.back());
  cout << (long long)(v.size()) << "\n";
  for (long long i = 0; i < (long long)(v.size()); ++i) {
    cout << v[i][0] << ' ' << v[i].back() << '\n';
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
