Shopping
题号:NC210535
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

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.
示例1

输入

复制
5 5
10 7 6 9 13
1 2 11
3 4 16
1 5 8
2 4 15
1 5 100000

输出

复制
1
2
1
2
5