#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
const int maxn = 2e5 + 5;
void solve() {
  long long n;
  long long d;
  cin >> n;
  cin >> d;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) {
    cin >> v[i];
  }
  long long lef = 0;
  long long rgt = 0;
  set<long long> s1;
  while (rgt < n) {
    if (s1.find(v[rgt]) != s1.end() && v[rgt] == v[lef]) {
      lef++;
    }
    s1.insert(v[rgt]);
    if (s1.size() == d) {
      break;
    }
    rgt++;
  }
  if (s1.size() != d) {
    cout << -1 << " " << -1 << '\n';
    return;
  }
  long long i = lef + 1;
  while (i < rgt) {
    if (v[i] == v[lef]) {
      lef++;
    }
    i++;
  }
  cout << lef + 1 << " " << rgt + 1 << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long l = 1;
  while (l--) {
    solve();
  }
  return 0;
}
