主页 讨论版 问题 名次 状态 统计
欢迎加入西电微软俱乐部招新群 588166170,做出福利题,免技术部第一次面试且赠送“福利”海报或小礼品~~~~
问题 F: Fighting Orz Pandas

问题 F: Fighting Orz Pandas

时间限制: 1 Sec  内存限制: 128 MB
提交: 46  解决: 17
[提交][状态][讨论版]

题目描述

There are many Orz pandas in the QQ group ACM_XDU-ICPC, each panda have a value IQ, they are all aggressive, An srO panda Ai will beat a Orz panda fixed the follow conditions: Have a smallest IQ among all the pandas whose IQ is higher than or equal to Ai.
There are N Orz pandas numbered from 1 to N (N<=100000) in the QQ group ACM_XDU-ICPC. Today M srO pandas (M<=100000) push into this group, please output the id of Orz pandas who will beaten by Mi srO paddas. If there are multi answer output the minimum id one. No answer output -1.(id is index of input of Orz Pandas. start from 1)

输入

Input
Several test cases, process to EOF
First line two number N and M.
Next N lines there are a number in each line. Stand for IQ of Ni Orz panda.
Next M lines there are a number in each line. Stand for IQ of Mi srO panda.

输出

For each case, output M numbers in a line. The number of Orz panda who will beaten by Mi srO

样例输入

3 4
1
2
3
1
2
3
4

样例输出

1 2 3 -1

提示

[提交][状态][讨论版]