#include using namespace std; using ll = long long; void process() { ll n, q; cin >> n >> q; vector a(n); for (ll i = 0; i < n; ++i) { cin >> a[i]; } vector s(n); s[0] = 0; for (ll i = 1; i < n; ++i) { ll c = a[i]; ll p = a[i - 1]; if (p <= c) { s[i] = s[i - 1]; } else { s[i] = s[i - 1] + 1; } } for (ll i = 0; i < q; ++i) { ll from, to; cin >> from >> to; --from; --to; ll begin = s[from]; ll end = s[to]; if (begin != end) { cout << "NO\n"; } else { cout << "YES\n"; } } } int main() { std::ios::sync_with_stdio(false); process(); cout.flush(); return 0; }