#include <bits/stdc++.h>
using namespace std;
const string LN = "\n";
const double eps = 1e-7;
const double pi = acos(-1.0);
const int INF = (int)1e9 + 7;
const long long LINF = (long long)9e18 + 7;
bool insert(int k, int x1, int x2) { return (k >= x1 && k <= x2); }
const int MAXN = 1000000;
int n, a[300007];
map<int, bool> was;
vector<pair<int, int> > ans;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  int k = 0;
  for (int i = 0; i < n; i++) {
    if (was[a[i]]) {
      ans.push_back(make_pair(k, i));
      k = i + 1;
      was.erase(was.begin(), was.end());
    } else
      was[a[i]] = true;
  }
  if (ans.size() == 0) cout << -1, exit(0);
  ans[ans.size() - 1].second = n - 1;
  cout << ans.size() << LN;
  for (int i = 0; i < ans.size(); i++)
    cout << ans[i].first + 1 << ' ' << ans[i].second + 1 << LN;
}
