#include <bits/stdc++.h>
using namespace std;
long d[long(1e6)], a[long(1e6)], n, m, k, b;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  k = m;
  while (cin >> a[++b] && k > 0)
    if (!d[a[b]]) k--, d[a[b]] = 1;
  long i = b;
  if (k > 0) {
    cout << "-1 -1";
    return 0;
  } else
    while (k < m && (i--)) {
      if (d[a[i]]) {
        d[a[i]] = 0;
        k++;
      }
    }
  cout << i << " " << b - 1;
}
