#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>usingnamespace std;int n, m;constint N =1000010;int st[N];intmain(){scanf("%d%d",&n,&m);for(int i =0; i < n; i++)scanf("%d",&st[i]);for(int i =0; i < m; i++){int l =0;int r = n -1;int x;scanf("%d",&x);//起始位置的确定while(l < r){int mid = l + r >>1;if(st[mid]>= x)
r = mid;else
l = mid +1;}if(st[l]== x){
cout << l <<" ";//最终位置确定
r = n -1;while(l < r){int mid = l + r +1>>1;//靠后寻找if(st[mid]<= x)
l = mid;else
r = mid -1;}
cout << r << endl;}else
cout <<"-1 -1"<< endl;}return0;}