#include <bits/stdc++.h>
/*
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
*/
using namespace std;
const double eps = 1e-10;
const double pi = 3.1415926535897932384626433832795;
const double eln = 2.718281828459045235360287471352;
#define f(i, a, b) for (int i = a; i <= b; i++)
#define scan(x) scanf("%d", &x)
#define mp make_pair
#define pb push_back
#define lowbit(x) (x&(-x))
#define fi first
#define se second
#define SZ(x) int((x).size())
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define summ(a) (accumulate(all(a), 0ll))
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
using ll=long long;
using a3=std::array<int,3>;
ll n,q,a[(int)1e5+9],cnt[(int)1e5+9],l=1,r,belong[(int)1e5+9],fk,ans[(int)1e5+9],sum;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin>>n>>q;
for(int i=1;i<=n;++i)cin>>a[i];
fk=ceil(n/sqrt(q));
for(int i=1;i<=n;++i)belong[i]=(i-1)/fk+1;
vector<a3> v;
for(int i=1,x,y;i<=q;++i){
cin>>x>>y;
v.push_back({x,y,i});
}
sort(all(v),[](const a3& aa,const a3& bb){return belong[aa[0]]==belong[bb[0]]?(belong[aa[0]]&1)^(aa[1]>bb[1]):belong[aa[0]]<belong[bb[0]];});
for(auto &&[aa,bb,cc]:v){
while(l>aa)sum+=(++cnt[a[--l]]==1);
while(r<bb)sum+=(++cnt[a[++r]]==1);
while(l<aa)sum-=(--cnt[a[l++]]==0);
while(r>bb)sum-=(--cnt[a[r--]]==0);
ans[cc]=sum==bb-aa+1;
}
for(int i=1;i<=q;++i)cout<<(ans[i]?"Yes\n":"No\n");
return 0;
}