text: /*
  "An anomaly, I'm Muhammad Ali
    Cause I know one day I'm gonna be the"
                  - Greatest, Eminem
  */
  #pragma GCC optimize ("O3")
  #pragma GCC target ("sse4")
  #include<bits/stdc++.h>
  #include<ext/pb_ds/assoc_container.hpp>
  #include<ext/pb_ds/tree_policy.hpp>
  using namespace std;
  using namespace __gnu_pbds;
  typedef long long int ll;
  #define ff first
  #define Shazam ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);
  #define ss second
  #define all(c) c.begin(),c.end()
  #define endl "\n"
  #define test() int t; cin>>t; while(t--)
  #define fl(i,a,b) for(int i = a ; i <b ;i++)
  #define get(a) fl(i,0,a.size())  cin>>a[i];
  #define pra(a) fl(i,0,a.size()) cout<<a[i]<<" ";	cout<<endl;
  #define pr(a,n) fl(i,0,n) cout<<a[i]<<" ";	cout<<endl;
  typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
  const ll INF = 2e18;
  const int inf = 2e9;
  const int mod1 = 1e9 + 7;
  
  
  
  int main(){
      Shazam;
      int n; cin >> n;
      int start = 0;
      map<int,int> f;
      vector<pair<int,int>> ans;
      for(int i = 0; i < n; i++){
          int k; cin >> k;
          if(f[k]){
              ans.push_back({start, i});
              start = i + 1;
              f.clear();
              continue;
          }
          f[k]++;
      }
      if(ans.size() == 0){
          cout << -1 << endl;
          return 0;
      }
      if(ans.back().ss != n-1){
          auto bk = ans.back();
          ans.pop_back();
          ans.push_back({bk.ff, n-1});
      }
      cout << ans.size() << endl;
      for(auto pp : ans){
          cout << pp.ff + 1 << " " << pp.ss + 1 << endl;
      }
      return 0;
  }