#include <bits/stdc++.h>
const int inf = 1000005;
using namespace std;
int n, k;
vector<int> arr;
void func() {
  map<int, int> mp;
  int i = 0, j = 0;
  while (j < int((arr).size()) && int((mp).size()) < k) {
    mp[arr[j++]]++;
  }
  if (mp.size() < k) {
    cout << -1 << " " << -1 << "\n";
    return;
  }
  while (i < j && int((mp).size()) == k) {
    mp[arr[i]]--;
    if (mp[arr[i]] == 0) mp.erase(arr[i]);
    i++;
  }
  cout << i << " " << j << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  arr.resize(n);
  for (int &x : arr) cin >> x;
  func();
  return 0;
}
