#include <bits/stdc++.h>
using namespace std;
set<int> s;
int n;
vector<int> ans;
bool have;
int main() {
  cin >> n;
  for (int a, i = 1; i <= n; i++) {
    scanf("%d", &a);
    if (!s.count(a)) {
      s.insert(a);
    } else {
      s.clear();
      ans.push_back(i + 1);
      have = 1;
    }
  }
  if (!have)
    cout << -1;
  else {
    int p = 0;
    if (!s.empty())
      p = 1;
    else
      p = 1;
    printf("%d\n", ans.size() - p + 1);
    cout << 1 << " ";
    for (int i = 0; i < ans.size() - p; i++) {
      printf("%d\n", ans[i] - 1);
      printf("%d ", ans[i]);
    }
    cout << n << endl;
  }
  return 0;
}
