#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[100010];
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  if (n == 1 && m == 1) {
    printf("1 1");
    return 0;
  }
  if (n == 1) {
    printf("-1 -1");
    return 0;
  }
  int begin = 0, end = 0;
  map<int, int> mp;
  int num = 1;
  int len = n;
  int l, r;
  mp[a[0]] = 1;
  int flag = 0;
  while (begin < n) {
    while (end < n && num < m) {
      end++;
      if (mp[a[end]] == 0) num++;
      mp[a[end]]++;
    }
    if (end == n) break;
    if (num == m) {
      flag = 1;
      while (num == m) {
        mp[a[begin]]--;
        if (mp[a[begin]] == 0) num--;
        begin++;
      }
      if (len > end - begin + 1 + 1) {
        len = end - begin + 1;
        l = begin - 1;
        r = end;
      }
      break;
    }
    mp[a[begin]]--;
    if (mp[a[begin]] == 0) num--;
    begin++;
  }
  if (flag == 0)
    printf("-1 -1");
  else
    printf("%d %d", l + 1, r + 1);
}
