Goat II

Problem Statement

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

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

The second line of input will consist of nn integers, the array AA.

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

Output

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

Constraints

For all test cases:

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

Sample Test Cases

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

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

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

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.