Submit solution


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

Author:
Problem type

Goat II

Problem Statement

Andy the goat is very hungry. Luckily, there is a line of n tufts of grass directly in front of him in a line. However, the i-th tuft of grass takes A_i seconds to eat.

Andy has q questions, each of the form "How many tufts of grass could I eat in B_i 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, n and q.

The second line of input will consist of n integers, the array A.

The third line of input will consist of q integers, each being the amount of tufts Andy is thinking about in one question.

Output

The output should consist of a single line of q integers, one for each question.

Constraints

For all test cases:

  • 1 \le n \le 10^5
  • 1 \le q \le 10^5
  • 1 \le A[i] \le 10^3
  • 1 \le B[i] \le 10^8

Sample Test Cases

Example 1
Input
3 2
1 5 9
7 16
Output
2 3
Explanation

In 7 seconds, Andy can eat the first two tufts of grass (takes 1 + 5 = 6 seconds).

In 16 seconds, Andy can eat all three tufts of grass (takes 1 + 5 + 9 = 15 seconds).


Comments

There are no comments at the moment.