C++#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
struct node{
int s,t,x;
} c[N];
int n,q,d[N];
signed main(){
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin>>n>>q;
for(int i=1;i<=n;i++){
cin>>c[i].s>>c[i].t>>c[i].x;
}
for(int i=1;i<=q;i++){
cin>>d[i];
}
sort(c+1,c+1+n,[](node a,node b){
return a.x<b.x;
});
for(int i=1;i<=q;i++){
int st=d[i];
int ans=-1;
for(int j=1;j<=n;j++){
int now=st+c[j].x;
if(now>=c[j].s-0.5&&now<=c[j].t-0.5){
ans=c[j].x;
break;
}
}
cout<<ans<<'\n';
}
return 0;
}