#include <bits/stdc++.h>
long long int mod = 1000000007;
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int ans = 0, index = 0;
  vector<int> answer;
  while (index < n) {
    int flag = 0;
    map<int, int> present;
    int temp = index;
    while (flag == 0 && temp < n) {
      if (present.count(arr[temp]) == 0) {
        present[arr[temp]]++;
        temp++;
      } else {
        flag = 1;
        answer.push_back(index);
        answer.push_back(temp);
      }
    }
    index = temp + 1;
  }
  if (answer.size() == 0) {
    cout << "-1" << endl;
    return 0;
  }
  answer[answer.size() - 1] = n - 1;
  cout << answer.size() / 2 << endl;
  for (int i = 0; i < answer.size(); i += 2) {
    cout << answer[i] + 1 << " " << answer[i + 1] + 1 << endl;
  }
}
