Goat II
Problem Statement
Andy the goat is very hungry. Luckily, there is a line of tufts of grass directly in front of him in a line. However, the -th tuft of grass takes seconds to eat.
Andy has questions, each of the form "How many tufts of grass could I eat in seconds?". Note that he must eat the tufts in the order given in the input.
Input
The first line of input will consist of two integers, and .
The second line of input will consist of integers, the array .
The third line of input will consist of integers, each being the amount of tufts Andy is thinking about in one question.
Output
The output should consist of a single line of integers, one for each question.
Constraints
For all test cases:
Sample Test Cases
Example 1
Input
3 2
1 5 9
7 16
Output
2 3
Explanation
In seconds, Andy can eat the first two tufts of grass (takes seconds).
In seconds, Andy can eat all three tufts of grass (takes seconds).
Comments