The first line contains two integers, denoting the length of given sequence and the number of quries respectively.
The second line containsintegers
, denoting the given sequence.
Followinglines each contains three integers
, denoting each query.
It's guaranteed that.
Outputlines each containing one integer, denoting the answers to the queries.