#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int arr[a];
  for (int i = 0; i < a; i++) {
    cin >> arr[i];
  }
  long long int ans = 0, ans1 = 0;
  set<int> s, t;
  int f = 0, ff = 0;
  for (int i = 0; i < a; i++) {
    t.insert(arr[i]);
    if (t.size() == b) {
      ans = i + 1;
      f = 1;
      break;
    }
  }
  for (int i = ans - 1; i >= 0; i--) {
    s.insert(arr[i]);
    if (s.size() == b) {
      ans1 = i + 1;
      ff = 1;
      break;
    }
  }
  if (f = 0 or ff == 0) {
    cout << "-1 -1" << endl;
  } else {
    cout << ans1 << " " << ans << endl;
  }
}
