/**
 ____ ____ ____ ____ ____ ____
||l |||e |||i |||n |||a |||d ||
||__|||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|/__\|

**/

#include<bits/stdc++.h>
#define endl '\n'

using namespace std;
typedef long long ll;

void speed()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
const int maxn = 11;
int n, q, a[maxn], ask[maxn][maxn], l, r, p[maxn];
int tf = -1;

void check()
{
    int cnt0 = 0, cnt1 = 0;
    for (int i = l; i <= r; i ++)
        if (p[i] == 0)
        cnt0 ++;
    else
        cnt1 ++;

    if (cnt0 == 0 || cnt1 == 0)
        return;

    int s1 = 0, s2 = (1 << 30) - 1;
    for (int j = l; j <= r; j ++)
    {
        if (p[j] == 1)
            s1 = (s1 | a[j]);
        else
            s2 = (s2 & a[j]);
    }

    if (s1 == s2)
        tf = 1;
}
void brute(int pos)
{
    if (pos == r + 1)
        check();
    else
    {
        p[pos] = 1;
        brute(pos + 1);
        p[pos] = 0;
        brute(pos + 1);
    }
}
void solve()
{
    cin >> n >> q;
    for (int i = 1; i <= n; i ++)
    {
        cin >> a[i];
    }

    for (int i = 1; i <= q; i ++)
    {
        cin >> l >> r;
        if (ask[l][r] == 0)
        {
            tf = -1;
            brute(l);
            ask[l][r] = tf;
        }


            if (ask[l][r] == -1)
                cout << "NO" << endl;
            else
                cout << "YES" << endl;
            continue;



    }

}

int main()
{
    solve();
    return 0;
}

