#include <bits/stdc++.h>
using namespace std;
int a[100001], b[100001] = {0}, c, d, i, j, n, m, l, r;
int main() {
  cin >> n >> m;
  l = 0;
  bool tr = false;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (b[a[i]] == 0) c++;
    if (c == m && !tr) tr = true, r = i;
    if (!tr) b[a[i]]++;
  }
  if (!tr)
    cout << "-1 -1" << endl;
  else {
    while (1) {
      if (r - l == 0) break;
      b[a[l]]--;
      if (b[a[l]] == 0) break;
      l++;
    }
    cout << l + 1 << " " << r + 1 << endl;
  }
  return 0;
}
