This time Sherlock comes to another problem that he has to shift his house from Birmingham to London. But as we all know that Sherlock never does a task which seems to be easy. So he wants to transfer his luggage.
For that Sherlock needs to order a truck. Now, each truck has some predefined weight W assigned. It means this truck can carry no more than W weights.
Watson asks Sherlock Q queries. In each query, Watson gives W and Sherlock need to answer what is the maximum number of items that he can put on a truck for given W. Help him.
Note: Sherlock knows weights of all items of his luggage initially.
In short, you are given an array A of N integers, the weights of the items. Then, you are given Q queries, each of which is a weight capacity of a truck. You must print the maximum number of items that can fit on the truck.
Input format:
Output format:
There should be Q lines of output, the answer to each query.
Constraints:
Subtasks:
Subtask #1 (30 points) : 1 <= N <= 500
Subtask #2 (70 points) : Original Constraints