include [HTML_REMOVED]
using namespace std;
const int N=1e6;
int q[N],x[N];
int n,m;
int main(){
cin>>n;
cin>>m;
for(int i=0;i[HTML_REMOVED]>q[i];
for(int i=0;i[HTML_REMOVED]>x[i];
}
for(int k=0;k[HTML_REMOVED]x[k]){
cout<<”-1 -1”<<endl;
}
else{
while(q[i]!=x[k]&&(j-i)>=1){
mid=i+j>>1;
if(q[mid]>=x[k]) j=mid;
else i=mid+1;
}
if(q[i]!=x[k])
cout<<"-1 -1"<<endl;
else{
cout<<i<<" ";
i=0,j=n-1;
while(q[j]!=x[k]){
mid=i+j>>1;
if(q[mid+1]<=x[k]) i=mid+1;
else j=mid;
}
cout<<j<<endl;
}
}
}
}