GUVI
Back

Solve explain

Created 3 years ago
149 Views
1 Comments
HarshitSoni-Al6w
@HarshitSoni-Al6w
HarshitSoni-Al6w
@HarshitSoni-Al6wProfile is locked. Login

Our dear friend Bablu loves Babli. To impress Babli he needs to collect chocolates for her. He collects Ai chocolates for N number of days. Babli now needs the chocolates.

Babli asks Bablu Q queries, in each query she asks him the number of days he takes to collect X number of chocolates.

Input

First line contains N and Q, the number of days and number of queries.

Second line contains N space separated integers denoting the chocolates collected by Bablu on ith day.

Then next line contains Q space separated integers X, denoting the number of chocolates required by Babli.

Output

For each of the Q queries, you have to output the number of days Bablu takes to collect X chocolates.

Constraints

1 <= N, Q <= 5*105

1 <= A[i] <= 105

1 <= X <= sum of all the chocolates collected.

Comments
Please login to comment.
 
Powered by habitate.io Habitate