#include <bits/stdc++.h>
using namespace std;
int a[311111], ok, k;
int main() {
  vector<pair<int, int> > ans;
  map<int, int> mp;
  int n, res = 0;
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i) {
    k = -1;
    for (int j = i; j <= n; ++j) {
      mp[a[j]]++;
      if (mp[a[j]] > 1) {
        ans.push_back(make_pair(i, j));
        k = j;
        ok = 1;
        break;
      }
    }
    if (k == -1) {
      if (ok == 0) {
        cout << -1;
        return 0;
      }
      break;
    }
    mp.clear();
    i = k;
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size() - 1; ++i) {
    cout << ans[i].first << " " << ans[i].second;
    cout << endl;
  }
  cout << ans[ans.size() - 1].first << " " << n;
}
