5239: 【56课】【3331】购买饮料
Memory Limit:128 MB
Time Limit:1.000 S
Judge Style:Text Compare
Creator:
Submit:63
Solved:30
Description
小 B 出门游玩,他现在走到了 n 家饮品店前,第i家买饮料的花费为 costi,他只能去花费不超过自己所带钱数额的店,但他现在不确定自己兜里有多少钱,所以现在给出 m 次询问,请问如果他有 ai元,他有几家饮品店可选?
Input
第一行两个整数分别表示 n,m。
第二行 n 个整数,第 i 个表示 costi,接下来 m 行,每行一个整数表示询问。1≤n,m,costi≤106 ,1≤ai≤1091。
Output
对于每次询问回答小 B 有几家饮品店可选。
Sample Input Copy
5 2
1 2 3 4 5
3
5
Sample Output Copy
3
5