#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
int n, i, j, cnt, tim, m, p, ar[300005];
vector<bool> mark;
vector<long long> v[300005];
long long dp[505][505], arr[505], k;
vector<long long> dis, low, sz;
unordered_map<int, int> mp, prv;
vector<pair<int, int>> ve;
int main() {
  set<int> s;
  scanf("%d", &n);
  for (long long i = 0; i < n; i++) {
    scanf("%d", &ar[i]);
    s.insert(ar[i]);
  }
  if (s.size() == n) {
    printf("%d", -1);
  } else {
    int cnt = 0;
    int fst = 0;
    for (long long i = 0; i < n; i++) {
      if (mp[ar[i]] && prv[ar[i]] >= fst) {
        cnt++;
        int lst = i;
        ve.push_back({fst, lst});
        fst = i + 1;
      }
      prv[ar[i]] = i;
      mp[ar[i]] = 1;
    }
    printf("%d", ve.size());
    printf("\n");
    for (i = 0; i < ve.size(); i++) {
      if (i == 0) ve[i].first = 0;
      if (i == ve.size() - 1) ve[i].second = n - 1;
      printf("%d", ve[i].first + 1);
      printf(" ");
      printf("%d", ve[i].second + 1);
      printf("\n");
    }
  }
}
