#include<stdio.h>
void ShellSort(long long a[],long long n)
{
long long i,j;
long long d;
long long tmp;
d=n/2;
while(d>0)
{
for(i=d;i<=n;i++)
{
tmp=a[i];
j=i-d;
while(j>=0&&tmp<a[j])
{
a[j+d]=a[j];
j=j-d;
}
a[j+d]=tmp;
}
d=d/2;
}
}
int main(){
long long n,m,x;
long long A[100000],tmp;
int i,j;
scanf("%lld%lld",&n,&m);
for(i=1;i<=n;i++){
scanf("%lld",&A[i]);
}
ShellSort(A,n);
long long a,b,mid,need;
for(i=0;i<m;i++){
a=1;b=n;mid=(a+b)/2;need=b;
scanf("%lld",&x);
while(a<=b){
if(A[mid]==x) {
need=mid;break;
}
else if(A[mid]>x) b=mid-1;
else {
a=mid+1; need=mid;
}
mid=(a+b)/2;
};
if(A[need]>x) printf("-1\n");
else printf("%d\n",A[need]);
}
return 0;
}