#include <iostream>
using namespace std;
int mid,l0;
int solve(int a1[],int l,int r,int x)
{
if(l==r&&l==&&a1[l]>x)
return -;
if(l==r&&a1[l]<=x)
return a1[l];
if(l==r&&a1[l]>x)
return solve(a1,l0,mid,x);
mid=(l+r)/;
l0=l;
if(a1[mid]>x)
return solve(a1,l,mid-,x);
else if(a1[mid]==x)
return a1[mid];
else
return solve(a1,mid+,r,x);
} int main()
{
int a[];
int n,m,x;
cin>>n>>m;
for(int i=;i<=n;i++)
{
cin>>a[i];
}
while(m--)
{
cin>>x;
cout<<solve(a,,n,x)<<endl;
}
return ;
}
要注意考虑只剩一个元素时的求解