#include #include #include int Input(){ int a = 0; std::cin>>a; return a; } int main(){ int n = 0, q = 0; n = Input(); q = Input(); std::vector arr; for(int i = 0; i < n; i++){ int a = Input(); arr.push_back(a); } for(int i = 0; i < q ; i++){ int from = Input() - 1; int to = Input() - 1; if(from == to){ std::cout << "YES" << std::endl; continue; } int prev = arr[from++]; bool flag = true; while(from <= to){ if(arr[from++] < prev){ flag = false; break; } } if(flag){ std::cout << "YES" << std::endl; }else{ std::cout << "NO" << std::endl; } } return 0; }