Match the Range

Limits 1s, 512 MB

Well, I will not waste your time and go straight to the problem.

You are given an array A of numbers. And some queries. Each query consists of two ranges. You need to find out if those two ranges are similar or not. You are given a function to figure out if two ranges are same or not.

function IsSame(x1, y1, x2, y2)
    Array1 = []
    Array2 = []

    For i = x1 to y1
        Array1.push(A[i])   
    end For 

    For i = x2 to y2
        Array2.push(A[i])   
    end For 

   NewArray1 = sort the elements inside Array1
   NewArray2 = sort the elements inside Array2

  return (NewArray1 equals NewArray2)
end function

Input

The first line contains two integer N - number of elements in the array and Q - number of queries.
Next line contains N integers denoting the ith element of the array A.

Next there are Q queries with four integers which is described above.

Output

For each query, use the function given above and if the function returns true value print "Yes" otherwise print "No" without quote .

Sample

InputOutput
6 3
1 2 3 1 2 3
1 3 4 6
2 4 3 5
1 2 2 3
Yes
Yes
No