#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  unordered_map<int, int> m;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  int r = 0;
  for (r = 0; r < n && k; r++) {
    if (m.find(v[r]) == m.end()) {
      --k;
    }
    m[v[r]]++;
  }
  int l = 0;
  while (m[v[l]] > 1) {
    m[v[l]]--;
    l++;
  }
  if (k > 0)
    cout << -1 << " " << -1 << endl;
  else
    cout << l + 1 << " " << r << endl;
}
