#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, c = 0, ans = -1, ans1 = 0, i;
  cin >> n >> k;
  int a[n];
  map<int, int> m;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (m[a[i]] == 0) c++;
    if (ans == -1 && c == k) {
      ans = i;
      m[a[i]]++;
    }
    if (ans == -1) m[a[i]]++;
  }
  for (i = 0; i <= ans - k; i++) {
    if (m[a[i]] > 1) {
      ans1++;
      m[a[i]]--;
    } else
      break;
  }
  if (ans == -1)
    cout << "-1"
         << " -1";
  else
    cout << ans1 + 1 << " " << ans + 1;
  return 0;
}
