Danny is going shopping to buy some toys. There are shops in his town which lies on a line. The
th shop has exactly one toy in it and costs
yuan. Danny wants to know the maximum number of toys he can buy if he has
yuan and only buys toys from
th shop to
th shop.
The first line contains two integers
, the number of shops and number of queries.
Next line contains
integers
, the cost of toy in each shop.
Next
lines, each line contains three integers
.
For each query, output an integer, the maximum number of toys Danny can buy.