#include <bits/stdc++.h>
using namespace std;
map<int, int> H;
int v[999999];
int main() {
  ios ::sync_with_stdio(false);
  int n, k, st = 0, dr = 1 << 30, R = 0, L;
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    cin >> v[i];
    H[v[i]]++;
    if (H.size() >= k) {
      R = i;
      break;
    }
  }
  if (!R) {
    cout << -1 << ' ' << -1;
    return 0;
  }
  for (int i = 1; i <= R; ++i) {
    if (H[v[i]] == 1) {
      L = i;
      break;
    }
    H[v[i]]--;
  }
  cout << L << ' ' << R;
  return 0;
}
