import sys
import math
input = sys.stdin.readline

x, y = map(int, input().split())
arr = list(map(int, input().split()))
res = []
test = []
prev = -float("inf")
count = 0
for i in arr:
    if i >= prev:
        count += 1
    else:
        count = 0
    prev = i
    test.append(count)
for i in range(y):
    a, b = map(int, input().split())
    # print(0, "IS NOT IN", test[a-1:b], not (0 in arr[a-1:b]))
    res.append(test[b-1] >= b-a)

    #res.append(not (0 in test[a-1:b]))

for q in res: print("YES" if q else "NO")