#include <bits/stdc++.h>
using namespace std;
struct cmpStruct {
  bool operator()(long long const &lhs, long long const &rhs) const {
    return lhs > rhs;
  }
};
int deleteVal(int val, set<int> &s) { s.erase(s.find(val)); }
int main() {
  int n, k, flag = 0;
  cin >> n >> k;
  std::vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  int l = 0, r = 0, diff = INT_MAX;
  set<int> s;
  std::vector<int> freq(1000001, 0);
  if (n < k)
    cout << -1 << " " << -1 << endl;
  else {
    for (int i = 0; i < n; i++) {
      s.insert(a[i]);
      freq[a[i]]++;
      if (s.size() == k) {
        r = i;
        flag = 1;
        break;
      }
    }
    diff = r - l;
    int minL = l, minR = r;
    int minDiff = diff;
    if (flag == 0)
      cout << -1 << " " << -1 << endl;
    else {
      while (true) {
        while (freq[a[l]] > 1) {
          freq[a[l]]--;
          l++;
        }
        while (freq[a[r]] > 1) {
          freq[a[r]]--;
          r--;
        }
        if (freq[a[l]] == 1 && freq[a[r]] == 1) break;
      }
      cout << l + 1 << " " << r + 1 << endl;
    }
  }
  return 0;
}
