#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  vector<bool> exist(100005, false);
  int a[n], c = 0;
  for (int i = 0; i < n; i += 1) {
    cin >> a[i];
    if (!exist[a[i]]) c++;
    exist[a[i]] = true;
  }
  if (c < k) {
    cout << "-1 -1\n";
    return 0;
  }
  exist.clear();
  exist.resize(100005, false);
  int s = a[0], i = 0;
  while (a[i] == a[0]) i++;
  i--, c = 0;
  while (i < n && c < k) {
    if (!exist[a[i]]) c++;
    exist[a[i]] = true;
    i++;
  }
  i--, c = 0;
  exist.clear();
  exist.resize(100005, false);
  int ansr = i + 1;
  while (i >= 0 && c < k) {
    if (!exist[a[i]]) c++;
    exist[a[i]] = true;
    i--;
  }
  i++;
  cout << i + 1 << ' ' << ansr << '\n';
}
