#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, cou = 0, x, a[100001];
  cin >> n >> k;
  map<int, int> mp;
  int l = -1, r = -1;
  for (int i = 0; i < n; i++) {
    cin >> x;
    a[i] = x;
    if (mp[x] == 0) {
      mp[x] = 1;
      cou++;
    } else {
      mp[x]++;
    }
    if (cou == k) {
      l = 0;
      r = i;
      break;
    }
  }
  if (l == -1 && r == -1) {
    cout << l << " " << r << endl;
    return 0;
  }
  if (k == 1) {
    cout << 1 << " " << 1 << endl;
    return 0;
  }
  while (mp[a[l]] > 1) {
    mp[a[l]]--;
    l++;
  }
  while (mp[a[r]] > 1) {
    mp[a[r]]--;
    r--;
  }
  cout << l + 1 << " " << r + 1 << endl;
  return 0;
}
