#include using namespace std; typedef long long ll; template ostream& operator<< (ostream& os, const vector & v) { os << "[ "; for (const T & elem : v) { os < elem << " "; } os << " ]"; return os; } void test_case() { ll n, q; cin >> n >> q; vector a(n + 1); for (ll i = 1; i <= n; ++i) cin >> a[i]; vector seq_starts(n + 1, 0); seq_starts[1] = 1; for (ll i = 2; i <= n; ++i) { if (a[i] >= a[i - 1]) seq_starts[i] = seq_starts[i - 1]; else seq_starts[i] = i; } for (ll i = 0; i < q; ++i) { ll l, r; cin >> l >> r; if (seq_starts[r] <= l) cout << "YES" << endl; else cout << "NO" << endl; } } int main() { cin.tie(0); cout.tie(0); cin.exceptions(ios::failbit); ios::sync_with_stdio(false); ll t = 1; // cin >> t; // potential comment while (t--) { test_case(); } return 0; }