n,q = map(int,input().split())
a = list(map(int,input().split()))

cur_l = 0
calc = []
start = 0
for i in range(n-1):
    if a[i] > a[i+1]:
        calc.append((start,i))
        start = i+1
calc.append((start,n-1))

for i in range(q):
    l,r = map(int,input().split())
    found = False
    for j in range(len(calc)):
        s = calc[j][0]
        e = calc[j][1]
        if l-1 >= s and r-1 <= e:
            found = True
            break
    if found:
        print("YES")
    else:
        print("NO")
