#include <bits/stdc++.h>
using namespace std;
int arr[1000000];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  if (k == 1) {
    cout << 1 << " " << 1 << endl;
    exit(0);
  }
  int i = 0;
  set<int> s;
  while (i < n && arr[i] == arr[i + 1]) i++;
  if (i >= n) {
    cout << "-1 -1" << endl;
  } else {
    s.insert(arr[i]);
  }
  int l = i;
  int r = 0;
  for (int j = i + 1; j < n; j++) {
    s.insert(arr[j]);
    if (s.size() == k) {
      r = j;
      break;
    }
  }
  if (r == 0)
    cout << "-1 -1" << endl;
  else {
    s.clear();
    for (int i = r; i >= l; i--) {
      s.insert(arr[i]);
      if (s.size() == k) {
        cout << i + 1 << " " << r + 1 << endl;
        return 0;
      }
    }
  }
}
