#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, a, noOfTerms = 0;
  map<int, int> pos;
  scanf("%d%d", &n, &k);
  for (int i = 1; noOfTerms < k && i <= n; i++) {
    scanf("%d", &a);
    if (pos.find(a) == pos.end()) {
      noOfTerms++;
    }
    pos[a] = i;
  }
  int l = 10e6, r = -1;
  if (noOfTerms == k) {
    for (typeof(pos.begin()) i = pos.begin(); i != pos.end(); i++) {
      l = min(l, i->second);
      r = max(r, i->second);
    }
  } else {
    l = r = -1;
  }
  printf("%d %d\n", l, r);
  return 0;
}
