#include <bits/stdc++.h>
using namespace std;
int n, k;
int flag[100001];
int a[100001];
int num[100001];
int Left[100001];
int Right[100001];
int main() {
  scanf("%d %d", &n, &k);
  int x;
  for (int i = 1; i <= n; i++) {
    num[i] = num[i - 1];
    scanf("%d", &a[i]);
    if (!flag[a[i]]) {
      num[i]++;
    }
    flag[a[i]]++;
  }
  for (int i = 1; i < n; i++) {
    if (num[i] != num[i + 1]) {
      Right[num[i]] = i;
    }
  }
  Right[num[n]] = n;
  Left[num[1]] = 1;
  for (int i = 2; i <= n; i++) {
    if (num[i] != num[i - 1]) {
      Left[num[i]] = i;
    }
  }
  int L = 1, R = n;
  int ans = 0;
  while (L <= R) {
    int mid = (L + R) >> 1;
    if (num[mid] < k) {
      L = mid + 1;
    }
    if (num[mid] > k) {
      R = mid - 1;
    }
    if (num[mid] == k) {
      ans = mid;
      break;
    }
  }
  if (!ans) {
    cout << -1 << " " << -1 << endl;
  } else {
    int start = 1;
    memset(flag, 0, sizeof(flag));
    for (int i = 1; i <= Left[num[ans]]; i++) {
      flag[a[i]]++;
    }
    while (flag[a[start]] > 1) {
      flag[a[start]]--;
      start++;
    }
    cout << start << " " << Left[num[ans]] << endl;
  }
  return 0;
}
