Limits 2s, 512 MB

You will be given some numbers. Then there will contain some queries. In every query there will be given a range and a number. You have to say that, the given number exists in the range of values or not.

Input

First line will contain two integer number n and q. Where n dentoes number of elements in the array and q denotes total number of queries.(1 ≤ n ≤ 105, 1 ≤ q ≤ 105)

Then there will be contained n number of elements ai.(1 ≤ ai ≤ 109)

Then there will be contained q lines which contains three numbers l,r and x; where l,r denotes the range of index and x denotes the number which you have to check that exist or not exist.(1 ≤ l ≤ r ≤ n and 1 ≤ x ≤ 109)

Output

There will be q lines of output. In every line if the number is contained in given range of values than you have to print "YES" otherwise you have to print "NO".

Sample

InputOutput
5 5
1 2 3 4 5
1 5 1
1 2 3
1 1 1
2 5 1
2 4 3
YES
NO
YES
NO
YES

Submit

Login to submit.

Contributors

Statistics

67% Solution Ratio
skmonirEarliest, May '20
nothing36Fastest, 0.0s
marvel_coderLightest, 786 kB
mdgaziur001Shortest, 307B
Toph uses cookies. By continuing you agree to our Cookie Policy.