AI Startup


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C, C++, Java, Python

You've created an AI startup that will revolutionise the world! To make sure you get lots of investors and venture capital funding, you want to make it known that you are an AI company. Your website, the marketing material, and applications to startup accelerators and VCs are packed with AI buzzwords. While this is sure to draw lots of investors in, you won't want to go too overboard. Otherwise, they will become a bit skeptical, and will be alienated from investing in your groundbreaking AI startup.

Each AI buzzword has an impact score s that determines how well-received your company will be. You want to maximise the number of buzzwords used, while keeping the total impact score below the threshold that will scare investors away.

Input

The first line contains integers n (1 \leq n \leq 1000) and m (1 \leq m \leq 100), the number of buzzwords in the list and the number of companies you want to apply to.

The next line contains n integers s (1 \leq s \leq 100), representing the the impact score of a particular buzzword. Different buzzwords can potentially have the same impact score.

The last line contains m integers k (1 \leq k \leq 10^4), the threshold you want to keep your total impact score below for each VC firm you apply to.

Output

For each firm you apply to, output the maximum number of buzzwords you can use while keeping your total impact score equal to or below the threshold. You may not reuse buzzwords once you have used them.

Example

Input 1
4 2
50 30 42 13
80 100
Output 1
2
3

For the first firm, you can use a maximum of two buzzwords to get a total impact score of 80 or below.

For the second firm, you can use a maximum of three buzzwords to get a total impact score of 100 or below.


Comments

There are no comments at the moment.