#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n, k;
cin>>n>>k;
vector<int>a(n);
for(int i=0; i<n; i++) cin>>a[i];
for(int i=0; i<k; i++){
int x;
cin>>x;
auto b=lower_bound(a.begin(), a.end(), x);
int c=*b;
if(c==x){
cout<<b-a.begin()+1<<" ";
auto d=upper_bound(a.begin(), a.end(), x);
cout<<d-a.begin()<<endl;
} else cout<<0<<endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8YWxnb3JpdGhtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwppbnQgbWFpbigpewoJaW50IG4sIGs7CgljaW4+Pm4+Pms7Cgl2ZWN0b3I8aW50PmEobik7Cglmb3IoaW50IGk9MDsgaTxuOyBpKyspIGNpbj4+YVtpXTsKCWZvcihpbnQgaT0wOyBpPGs7IGkrKyl7CgkJaW50IHg7CgkJY2luPj54OwoJCWF1dG8gYj1sb3dlcl9ib3VuZChhLmJlZ2luKCksIGEuZW5kKCksIHgpOwoJCWludCBjPSpiOwoJCWlmKGM9PXgpewoJCQljb3V0PDxiLWEuYmVnaW4oKSsxPDwiICI7CgkJCWF1dG8gZD11cHBlcl9ib3VuZChhLmJlZ2luKCksIGEuZW5kKCksIHgpOwoJCQljb3V0PDxkLWEuYmVnaW4oKTw8ZW5kbDsKCQl9IGVsc2UgY291dDw8MDw8ZW5kbDsKCX0KCXJldHVybiAwOwp9