还没写
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 100010;
int n,q;
int a[N];
int lfind(int x)
{
int l=0, r=n-1;
int mid;
while(l<r)
{
mid=(l+r)>>1;
if(a[mid]>=x)
{
r=mid;
}
else
{
l=mid+1;
}
}
return a[r]!=x?-1:r;
}
int rfind(int x)
{
int l,r;
l=0,r=n-1;
int mid;
while(l<r)
{
mid=(l+r+1)>>1;
if(a[mid]<=x)
{
l=mid;
}
else
{
r=mid-1;
}
}
return a[r]!=x?-1:r;
}
int main()
{
cin>>n>>q;
for (int i = 0; i < n; i ++ ){
cin>>a[i];
}
while(q--)
{
int k;
cin>>k;
cout<<lfind(k)<<" "<<rfind(k)<<endl;
}
}