#include <bits/stdc++.h>
using namespace std;
inline int read()
{
register int x=0,f=0;
register char ch=getchar();
while(ch<'0' || ch>'9')
f|=ch=='-',ch=getchar();
while(ch>='0' && ch<='9')
x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
return f?-x:x;
}
const int maxn=1e5+7;
int n,m;
int a[maxn];
int b[maxn];
struct sequences
{
int l,r;
int id;
};
sequences s[maxn];
bool cmp(sequences x, sequences y)
{
return b[x.l]==b[y.l]?x.r<y.r:b[x.l]<b[y.l];
}
int cnt[maxn];
int add(int x)
{
return cnt[a[x]]++?0:1;
}
int sub(int x)
{
return --cnt[a[x]]?0:-1;
}
int res;
bool ans[maxn];
int main()
{
n=read(),m=read();
int len=sqrt(n);
int bn=ceil((double)n/len);
for(int i=1;i<=bn;i++)
for(int j=(i-1)*len;j<=i*len;j++)
b[i]=j;
for(int i=1;i<=n;i++)
a[i]=read();
for(int i=1;i<=m;i++)
{
s[i].l=read(),s[i].r=read();
s[i].id=i;
}
sort(s+1,s+m+1,cmp);
int l=1,r=0;
for(int i=1;i<=m;i++)
{
while(l<s[i].l) res+=sub(l++);
while(l>s[i].l) res+=add(--l);
while(r<s[i].r) res+=add(++r);
while(r>s[i].r) res+=sub(r--);
ans[s[i].id]=(res==s[i].r-s[i].l+1?true:false);
}
for(int i=1;i<=m;i++)
puts(ans[i]?"Yes":"No");
}