#include int nums[1'000'000]; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, q; cin >> n >> q; for (int i = 0; i < n; ++i) { cin >> nums[i]; } int l, r; next: while (q-- && q >= 0) { cin >> l >> r; if (r - l == 0) { cout << "YES" << "\n"; continue; } for (int i = l - 1; i < r - 1; i++) { if (nums[i] > nums[i + 1]) { cout << "NO" << "\n"; goto next; } } cout << "YES" << "\n"; } return 0; }