#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  cin >> n;
  set<int> st;
  int j = 1, m[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> x;
    if (st.empty() || st.find(x) == st.end())
      st.insert(x);
    else
      m[j++] = i, st.clear();
  }
  m[j - 1] = n;
  if (j == 1)
    cout << "-1";
  else {
    cout << j - 1 << endl;
    cout << "1 " << m[1] << endl;
    for (int i = 1; i < j - 1; i++) cout << m[i] + 1 << " " << m[i + 1] << endl;
  }
  return 0;
}
