#include<bits/stdc++.h>
#include <iterator>
using namespace std;
int main() {
set<int>s;
//write your code here......
int n, m, x, a;
cin >> n;
cin >> m;
for (int i = 0; i < n; i++) {
cin >> a;
s.insert(a);
}
for (int i = 0; i < m; i++) {
cin >> x;
auto it = s.upper_bound(x);
if (it == s.end())
cout << -1 << endl;
else
cout << *it << endl;
}
return 0;
}

京公网安备 11010502036488号