#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;
const int M=2005;
int n,m,st,ed,t,a[N],f=1,s1=0,s2=10000;
vector <int> g[M],gg[M];
int main() {
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>a[i];
}
for(int f=1; f<=n; f++) {
if(m+f<=n) {
t=m;
for(int i=f; i<=n; i++) {
g[a[i]].push_back(i);
if(g[a[i]].size()==1) {
t--;
}
if(t==0) {
ed=i;
break;
}
}
t=m;
for(int i=ed; i>=f; i--) {
gg[a[i]].push_back(i);
if(gg[a[i]].size()==1) {
t--;
}
if(t==0) {
st=i;
break;
}
}
}
if(ed-st<s2-s1) {
s1=st,s2=ed;
}
}
cout<<s1<<" "<<s2;
return 0;
}