#include <bits/stdc++.h>
using namespace std;
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; // find_by_order, order_of_key
#define ll long long
#define vi vector<int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vvi vector<vi>
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define vpii vector<pair<int,int>>
#define vpll vector<pair<ll,ll>>
int Set(int N, int pos) {return N = N | (1<<pos);}
int Reset(int N, int pos) {return N = N & ~(1<<pos);}
bool Cheek(int N, int pos) {return (bool)(N & (1<<pos));}
#define least_one_pos(x) __builtin_ffs(x)
#define leading_zeros(x) __builtin_clz(x)
#define tailing_zeros(x) __builtin_ctz(x)
#define num_of_one(x) __builtin_popcount(x)
///............x...........///
#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define mp(a, b) make_pair(a, b)
#define pb push_back
#define UNIQUE(X) (X).erase(unique(all(X)), (X).end())
#define ft cout << "for test"<<endl;
#define print(v) for (auto it : v)cout << it<<" ";cout << endl;
#define PI acos(-1.0)
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define t_c int test, cs = 1;cin>>test;while (test--)
///................function.....................///
//#define mod 1000000007
//........constant........///
const ll N = 1e6+5;
void file(){
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
}
class Merge_Sort_Tree{
public:
vector<int> v;
vector<vector<int>> tree;
int n;
Merge_Sort_Tree(int _n){
n=_n;
v.resize(n+1);
tree.resize(4*n);
}
void Merge(int nd){
int l = nd*2,r=nd*2+1;
int n1 = (int)(tree[nd*2].size());
int n2 = (int)(tree[nd*2+1].size());
int i=0,j=0;
while(i<n1&&j<n2){
if(tree[l][i]<tree[r][j]){
tree[nd].push_back(tree[l][i++]);
}
else{
tree[nd].push_back(tree[r][j++]);
}
}
while(i<n1)tree[nd].push_back(tree[l][i++]);
while(j<n2)tree[nd].push_back(tree[r][j++]);
}
void build(int nd, int b, int e){
if(b>e)return;
if(b==e){
tree[nd].push_back(v[b]);
return ;
}
int m = (b+e)/2;
build(nd*2,b,m);
build(nd*2+1,m+1,e);
Merge(nd);
}
bool query(int nd, int b, int e, int l, int r, int k){
if(b>r||e<l)return 0;
if(l<=b&&e<=r){
// int pos = upper_bound(tree[nd].begin(),tree[nd].end(),k)-tree[nd].begin();
// return (int)(tree[nd].size())-pos;
return binary_search(all(tree[nd]),k);
}
int m=(b+e)/2;
int p1 = query(nd*2,b,m,l,r,k);
int p2 = query(nd*2+1,m+1,e,l,r,k);
return (p1|p2);
}
};
int main(){
FIO;
// file();
int n,q,i,j;
cin>>n>>q;
Merge_Sort_Tree obj(n);
for(i=1; i<=n; i++)cin>>obj.v[i];
obj.build(1,1,n);
while(q--){
int l,r,x;
cin>>l>>r>>x;
x = obj.query(1,1,n,l,r,x);
cout<<(x?"YES":"NO")<<endl;
}
}