You've got an array, consisting of *n* integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub>. Also, you've got *m* queries, the *i*-th query is described by two integers *l*<sub class="lower-index">*i*</sub>, *r*<sub class="lower-index">*i*</sub>. Numbers *l*<sub class="lower-index">*i*</sub>, *r*<sub class="lower-index">*i*</sub> define a subsegment of the original array, that is, the sequence of numbers *a*<sub class="lower-index">*l*<sub class="lower-index">*i*</sub></sub>, *a*<sub class="lower-index">*l*<sub class="lower-index">*i*</sub> + 1</sub>, *a*<sub class="lower-index">*l*<sub class="lower-index">*i*</sub> + 2</sub>, ..., *a*<sub class="lower-index">*r*<sub class="lower-index">*i*</sub></sub>. For each query you should check whether the corresponding segment is a ladder. 

A ladder is a sequence of integers *b*<sub class="lower-index">1</sub>, *b*<sub class="lower-index">2</sub>, ..., *b*<sub class="lower-index">*k*</sub>, such that it first doesn't decrease, then doesn't increase. In other words, there is such integer *x* (1 ≤ *x* ≤ *k*), that the following inequation fulfills: *b*<sub class="lower-index">1</sub> ≤ *b*<sub class="lower-index">2</sub> ≤ ... ≤ *b*<sub class="lower-index">*x*</sub> ≥ *b*<sub class="lower-index">*x* + 1</sub> ≥ *b*<sub class="lower-index">*x* + 2</sub>... ≥ *b*<sub class="lower-index">*k*</sub>. Note that the non-decreasing and the non-increasing sequences are also considered ladders.
The first line contains two integers *n* and *m* (1 ≤ *n*, *m* ≤ 10<sup class="upper-index">5</sup>) — the number of array elements and the number of queries. The second line contains the sequence of integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>), where number *a*<sub class="lower-index">*i*</sub> stands for the *i*-th array element.

The following *m* lines contain the description of the queries. The *i*-th line contains the description of the *i*-th query, consisting of two integers *l*<sub class="lower-index">*i*</sub>, *r*<sub class="lower-index">*i*</sub> (1 ≤ *l*<sub class="lower-index">*i*</sub> ≤ *r*<sub class="lower-index">*i*</sub> ≤ *n*) — the boundaries of the subsegment of the initial array.

The numbers in the lines are separated by single spaces.
import sys
#sys.setrecursionlimit(10**7)
input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))
############ ---- Input Functions ---- ############

def Ladder():
    n,m = invr()
    sequence = inlt()

    increasing_till_after_index = []
    increasing_till_before_index = []

    ptr1 = 0 
    ptr2 = 0

    while ptr1 <= (n-1):
        if ptr2 < ptr1:
            ptr2  = ptr1 

        while ptr2 <= (n-2) and sequence[ptr2+1] >= sequence[ptr2]:
            ptr2 += 1 
        
        increasing_till_after_index.append((ptr2))
        ptr1 += 1 
    
    #print(increasing_till_after_index)

    ptr1 = n-1
    ptr2 = n-1

    while ptr1 >= 0 :
        if ptr2 > ptr1:
            ptr2 = ptr1 

        while ptr2 >= 1 and sequence[ptr2-1] >= sequence[ptr2]:
            ptr2 -= 1 

        increasing_till_before_index.append(ptr2)
        ptr1 -= 1 

    increasing_till_before_index.reverse()
    #print(increasing_till_before_index)

    outputStr = ''

    for i in range(m):
        l,r = invr()

        if increasing_till_after_index[l-1] >= increasing_till_before_index[r-1]:
            #print("Yes")
            outputStr += 'Yes' + '\n'
        else:
            #print("No")
            outputStr += 'No' + '\n'  
    
    outputStr = outputStr.strip()
    print(outputStr)
    return 


Ladder()