#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
using namespace std;
long long MOD = 998244353;
double eps = 1e-12;
void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  set<int> s;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    s.insert(v[i]);
  }
  if (s.size() < k) {
    cout << "-1 -1" << endl;
    return;
  }
  if (k == 1) {
    cout << "1 1" << endl;
    return;
  }
  unordered_map<int, int> arr;
  for (int i = 0; i < n; i++) arr[v[i]]++;
  int diff = s.size();
  int right = n - 1;
  int last = -1;
  while (right > 0) {
    arr[v[right]] -= 1;
    last = v[right];
    if (arr[v[right]] == 0) {
      arr.erase(v[right]);
      diff -= 1;
    }
    if (diff < k) {
      diff = k;
      right += 1;
      break;
    }
    right -= 1;
  }
  arr[last] += 1;
  int left = 0;
  while (left < right) {
    arr[v[left]] -= 1;
    last = v[left];
    if (arr[v[left]] == 0) {
      arr.erase(v[left]);
      diff -= 1;
    }
    if (diff < k) {
      left += 1;
      break;
    }
    left += 1;
  }
  cout << left << " " << right << endl;
  return;
  cout << "-1 -1" << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  for (int it = 1; it <= t; it++) {
    solve();
  }
  return 0;
}
