#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<vector<int>> res;
  int start = 0, i = 0;
  unordered_set<int> mp;
  while (i < n) {
    if (mp.find(a[i]) == mp.end())
      mp.insert(a[i++]);
    else {
      res.push_back({start, i});
      start = ++i;
      mp.clear();
    }
  }
  if (res.size() == 0) {
    cout << -1;
    return 0;
  }
  res.back()[1] = n - 1;
  cout << res.size() << endl;
  for (auto i : res) cout << i[0] + 1 << " " << i[1] + 1 << endl;
  return 0;
}
