#include <bits/stdc++.h>
using namespace std;
int counts[100001];
int a[100001];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= 100001; i++) counts[i] = 0;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int num = 1;
  counts[a[1]] = 1;
  int curr = 2;
  while (num < k && curr <= n) {
    if (!counts[a[curr]]) {
      counts[a[curr]] = 1;
      num++;
    } else {
      counts[a[curr]]++;
    }
    curr++;
  }
  if (num < k) {
    cout << "-1 -1\n";
    return 0;
  }
  int i;
  for (i = 1; i < curr - 1; i++) {
    if (counts[a[i]] > 1) {
      counts[a[i]]--;
    } else
      break;
  }
  cout << i << " " << (curr - 1) << endl;
}
