#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int arr[100005];
  int pos[100005], pr[100005] = {0};
  int i, j, ans = 0;
  for (i = 0; i < n; i++) {
    cin >> arr[i];
    if (pr[arr[i]] == 0) ans++;
    pr[arr[i]]++;
    pos[arr[i]] = i;
    if (ans == k) {
      j = i;
      break;
    }
  }
  for (i = j + 1; i < n; i++) cin >> arr[i];
  if (ans < k)
    cout << "-1 -1";
  else {
    int min = j + 1;
    for (i = 0; i < j; i++) {
      if (pos[arr[i]] < min) min = pos[arr[i]];
    }
    if (j != 0)
      cout << min + 1 << " " << j + 1;
    else
      cout << "1 1";
  }
  return (0);
}
