LearnPy Hub
← Arena
IntermediateRating 1200

Largest Not Above

For each query x, print the largest number in the list that is ≤ x, or -1 if none.

Input

n and q; n integers; q queries on one line.

Output

q integers on one line.

Sample 1

Input
5 3
1 9 4 10 2
5 0 100
Output
4 -1 10

Sample 2

Input
66 9
829 197 947 272 269 63 267 937 404 383 551 644 964 217 445 359 884 298 144 888 391 133 572 52 282 467 280 744 877 619 476 307 766 128 290 538 246 990 551 861 531 120 540 113 452 186 103 884 737 554 216 278 318 217 594 777 284 370 107 302 424 877 49 212 370 273
281 195 444 1032 348 103 263 24 527
Output
280 186 424 990 318 103 246 -1 476
solution.py
Output appears here
Largest Not Above · Python Arena problem · LearnPy Hub