#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e6;
int a[maxn], b[maxn], n, j, cur, res1, res2, k;
void add(int u) {
  b[a[u]]++;
  if (b[a[u]] == 1) cur++;
}
void rem(int u) {
  b[a[u]]--;
  if (!b[a[u]]) cur--;
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  j = 1;
  for (int i = 1; i <= n; i++) {
    while (j <= n and cur <= k) add(j++);
    if (cur > k) rem(--j);
    if ((j - 1 - i) >= (res2 - res1)) res1 = i, res2 = j - 1;
    rem(i);
  }
  cout << res1 << " " << res2;
}
