In the corporate realm of Raymond's company, employees occasionally slack during work hours. Raymond's vigilant boss conducts surprise checks to ensure that his employees' tasks are on track. Raymond is tasked with ensuring all numbers in an array of length are the same.
Each surprise inspection by his boss focuses on a specific subarray of . Given the sudden nature of these checks, Raymond must act swiftly to showcase the selected section of his work is uniform and consistent. In the -th inspection, Raymond's boss focuses on the subarray .
Raymond has two quick-fix strategies to make the elements in the selected subarray appear the same:
- Choose an index . For every index in the array , increase by .
- Choose an index . For every index in the array , multiply by .
Help Raymond determine, for each of these sudden inspections, whether it is possible to make all numbers in the subarray the same using the strategies above at most twice.
Any changes Raymond makes will revert at the end of each inspection, so the array will return to its original state before any subsequent inspection.
Constraints
For all subtasks:
Subtask 1 [30%]
Subtask 2 [70%]
No additional constraints.
Input Specification
The first line contains two integers and , representing the size of the array and the number of sudden inspections.
The second line contains space-separated integers, .
The next lines each contain two integers, and , describing the -th sudden inspection.
Output Specification
For each sudden inspection, print YES
if it is possible for all elements in the subarray to become the same after performing the strategies at most twice, and NO
otherwise.
Sample Input
6 5
-2 3 3 3 2 0
1 6
2 3
3 5
1 5
1 4
Sample Output
YES
YES
NO
YES
NO
Comments