#include <algorithm>
#include <iostream>
#include <vector>
#define endl '\n'
using namespace std;

const int MAXN = 100000;

int a[MAXN + 5], And[30], Or[MAXN + 5][30];

bool check(int a[], int b[])
{
    for (int i = 0; i < 30; ++ i)
    {
        if (a[i] != b[i]) return false;
    }
    return true;
}

int main()
{
    ios :: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int n, q;
    cin >> n >> q;

    for (int i = 1; i <= n; ++ i)
    {
        cin >> a[i];
        a[i] = i;
    }

    vector< pair<int, int> > v;
    for (int i = 1; i <= n; ++ i)
    {
        v.push_back(make_pair(a[i], i));
    }

    sort(v.begin(), v.end());

    for (int i = 1; i <= q; ++ i)
    {
        int l, r;
        cin >> l >> r;

        int pos = 1;
        for (int i = 0; i < n; ++ i)
        {
            if (l <= v[i].second and v[i].second <= r)
            {
                int t = v[i].first;
                for (int j = 0; j < 30; ++ j)
                {
                    Or[pos][j] = Or[pos - 1][j];
                    if (t % 2) Or[pos][j] = 1;
                    t /= 2;
                }
                pos++;
            }
        }

        pos = r - l + 1;
        bool flag = false;
        for (int i = 0; i < 30; ++ i)
        {
            And[i] = 1;
        }
        for (int i = n - 1; i >= 0 and pos > 1; -- i)
        {
            if (l <= v[i].second and v[i].second <= r)
            {
                int t = v[i].first;
                for (int j = 0; j < 30; ++ j)
                {
                    if (!(t % 2)) And[j] = 0;
                    t /= 2;
                }
                pos--;
                if (check(And, Or[pos]))
                {
                    flag = true;
                    break;
                }
            }
        }

        if (flag) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

    return 0;
}
