#include <bits/stdc++.h>
const long long mod = 1e8 + 7;
const long long eps = 1e-12;
using namespace std;
int n, a[300000 + 5];
map<int, bool> vis;
vector<pair<int, int> > ans;
int main() {
  while (cin >> n) {
    vis.clear();
    ans.clear();
    for (int(i) = (1); (i) <= (n); ++(i)) cin >> a[i];
    int pre = 0;
    for (int(i) = (1); (i) <= (n); ++(i)) {
      if (vis[a[i]]) {
        ans.push_back(make_pair(pre + 1, i));
        vis.clear();
        pre = i;
      } else
        vis[a[i]] = true;
    }
    if (!ans.size())
      cout << -1 << endl;
    else {
      cout << ans.size() << endl;
      for (int(i) = (0); (i) <= (ans.size() - 1); ++(i))
        cout << ans[i].first << " " << (i == ans.size() - 1 ? n : ans[i].second)
             << endl;
    }
  }
  return 0;
}
