#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define MP make_pair
#define pb push_back
typedef long long ll;
int n,m;
int a[100005];
int res[100005],cnt[100005],ans,unit;
void add(int x)
{
x = a[x];
if(!cnt[x]) ans++;
cnt[x]++;
}
void del(int x)
{
x = a[x];
cnt[x]--;
if(!cnt[x]) ans--;
}
struct node{
int id,l,r;
bool operator < (const node & x) const
{
if(l / unit != x.l / unit) return l < x.l;
if((l / unit) & 1) return r < x.r;
return r > x.r;
}
}q[100005];
int main ()
{
scanf("%d%d",&n,&m);
unit = sqrt(n);
for(int i=1;i<=n;i++) scanf("%d",&a[i]);
for(int i=1;i<=m;i++) scanf("%d%d",&q[i].l,&q[i].r), q[i].id = i;
sort(q+1, q+1+m);
int l = 0, r = 0;
for(int i=1;i<=m;i++)
{
int ql = q[i].l, qr = q[i].r;
while(l < ql) del(l++);
while(l > ql) add(--l);
while(r < qr) add(++r);
while(r > qr) del(r--);
if(ans == (qr - ql + 1)) res[q[i].id] = 1;
}
for(int i=1;i<=m;i++)
{
if(res[i] == 1) printf("Yes\n");
else printf("No\n");
}
return 0;
}