#include<iostream>
#include<cstdio>
#define maxm 2010
#define maxn 10000005
using namespace std;
int a[maxn], b[maxm];
int Q[maxn], ans = maxn;
int main() {
freopen("exhibit.in", "r", stdin);
freopen("exhibit.out", "w", stdout);
int n, m;
int k = 0;
int front = 0, back = -1;
int l = 0, r = 0;
cin >> n >> m;
for(int i = 0; i < n; i++) {
cin >> a[i];
Q[++back] = i;
if(b[a[i]] == 0) k++;
b[a[i]] ++;
while(b[a[Q[front]]] > 1) {
b[a[Q[front]]]--;
front ++;
}
if(k == m) {
if(Q[back] - Q[front] < ans) {
ans = Q[back] - Q[front];
l = Q[front];
r = Q[back];
}
}
}
cout<<l+1 <<" " << r+1;
return 0;
}