n,q = map(int,input().split())
a = list(map(int,input().split()))

for i in range(q):
    l,r = map(int,input().split())
    cur_l = l-1
    found = False
    while l < r:
        if a[cur_l] > a[l]:
            found = True
            break
        l += 1
        cur_l += 1
    if found:
        print("NO")
    else:
        print("YES")
