#include <time.h>

#include <stdlib.h>
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <bitset>
#include <iterator>
#include <deque>
#include <string>
#include <queue>
#include <omp.h>
#include <fstream>   // ifstream, ofstream
typedef int64_t ll;
using namespace std;
const ll INF=1e10;
struct Construction{
	ll s;
	ll t;
	ll position;
};
bool operator<(const Construction &a,const Construction &b){
	return a.position<b.position;
}

#include <cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>

class SegmentTree_range {
public:
	SegmentTree_range(int64_t size,const int64_t *d);
	SegmentTree_range(const SegmentTree_range& t);
	SegmentTree_range& operator=(const SegmentTree_range& t);
	int64_t get(const int64_t address) const;
	void change(const int64_t a,const int64_t b,const int64_t value);//[a,b]の値をvalueに更新
	virtual ~SegmentTree_range();
protected:
	struct unit{
		bool need_further = true;
		int64_t value;
	};
	int64_t max_depth;
	int64_t get(const int64_t address,const int64_t ptr,const int64_t range_min,const int64_t range_max) const;
	//calcminからよばれる内部処理 [a,b]について、配列番号ptrのものを探索 配列番号ptrが指す範囲は、[range_min,range_max]
	void change(const int64_t a,const int64_t b,const int64_t value,const int64_t ptr,const int64_t range_min,const int64_t range_max);
	int64_t size;
	unit *data;
};
SegmentTree_range::SegmentTree_range(int64_t dsize,const int64_t *d) {

	// TODO 自動生成されたコンストラクター・スタブ
	for(int i=63;i>=0;i--){
		if(dsize&((uint64_t)1<<i)){
			max_depth = i+1;
			break;
		}
	}
	this->size = ((uint64_t)1<<(max_depth));
	data = new unit[2*size-1];
	for(int64_t i=0;i<dsize;i++){
		data[size-1+i].value=d[i];
		data[size-1+i].need_further=false;
	}
	for(int64_t i=dsize;i<size;i++){
		data[size-1+i].value=std::numeric_limits<int64_t>::max();
		data[size-1+i].need_further=false;
	}
	for(int64_t i=size-2;i>=0;i--){
		if((!data[2*i+1].need_further)&&(!data[2*i+2].need_further)&&data[2*i+1].value==data[2*i+2].value){
			data[i].need_further=false;
			data[i].value=data[2*i+1].value;
		}else{
			data[i].need_further=true;
		}
	}
}
SegmentTree_range::SegmentTree_range(const SegmentTree_range& t){
	if(&t==this){
		max_depth = 1;
		size = 1;
		data = new unit[1];
		data[0].value=0;
		data[0].need_further=false;
	}else{
		max_depth = t.max_depth;
		size = t.size;
		data = new unit[2*size-1];
		for(int64_t i=0;i<(2*size-1);i++){
			data[i].need_further=t.data[i].need_further;
			data[i].value=t.data[i].value;
		}
	}
}
SegmentTree_range& SegmentTree_range::operator=(const SegmentTree_range& t){
	if(&t!=this){
		delete[] data;
		max_depth = t.max_depth;
		size = t.size;
		data = new unit[2*size-1];
		for(int64_t i=0;i<(2*size-1);i++){
			data[i].need_further=t.data[i].need_further;
			data[i].value=t.data[i].value;
		}
	}
	return *this;
}
int64_t SegmentTree_range::get(const int64_t address) const{
	return get(address,0,0,size-1);
}
int64_t SegmentTree_range::get(const int64_t address,const int64_t ptr,const int64_t range_min,const int64_t range_max) const{
	if(data[ptr].need_further){
		int64_t border = (range_max+range_min-1)/2;
		if(address<=border){
			return get(address,2*ptr+1,range_min,border);
		}else{
			return get(address,2*ptr+2,border+1,range_max);
		}
	}else{
		return data[ptr].value;
	}
}

void SegmentTree_range::change(const int64_t a,const int64_t b,const int64_t value){
	change(a,b,value,0,0,size-1);
}
void SegmentTree_range::change(const int64_t a,const int64_t b,const int64_t value,const int64_t ptr,const int64_t range_min,const int64_t range_max){
	int64_t border = (range_max+range_min-1)/2;
	if(a<=range_min&&b>=range_max){
		data[ptr].need_further=false;
		data[ptr].value=value;
	}else{
		if(!data[ptr].need_further){
			data[2*ptr+1].need_further=false;
			data[2*ptr+2].need_further=false;
			data[2*ptr+1].value=data[ptr].value;
			data[2*ptr+2].value=data[ptr].value;
		}
		data[ptr].need_further=true;
		if(b<=border){
			change(a,b,value,2*ptr+1,range_min,border);
		}else if(a>=border+1){
			change(a,b,value,2*ptr+2,border+1,range_max);
		}else{
			change(a,border,value,2*ptr+1,range_min,border);
			change(border+1,b,value,2*ptr+2,border+1,range_max);
		}
	}
}
SegmentTree_range::~SegmentTree_range(){

}
int main(){
	ll n,q;
	cin>>n>>q;
	vector<Construction> con;
	for(ll i1=0;i1<n;i1++){
		ll s,t,x;
		cin>>s>>t>>x;
		con.push_back(Construction{s,t,x});
	}
	sort(con.begin(),con.end());
	reverse(con.begin(),con.end());
	vector<ll> d;
	ll temp[q];
	for(int i1=0;i1<q;i1++){
		ll temp;
		cin>>temp;
		d.push_back(temp);
	}
	for(ll i1=0;i1<q;i1++){
		temp[i1]=-1;
	}

	SegmentTree_range ans(q,temp);
	for(auto i1=con.begin();i1!=con.end();i1++){
		ll time_beginning = (i1->s)-(i1->position);
		ll time_end = (i1->t)-(i1->position);
		if(time_beginning > d[q-1]){
			continue;
		}
		auto begin_iter = lower_bound(d.begin(),d.end(),time_beginning);
		auto end_iter = lower_bound(d.begin(),d.end(),time_end);
		ll begin_index = distance(d.begin(),begin_iter);
		ll end_index = distance(d.begin(),end_iter);
		if(end_index-1<begin_index){
			continue;
		}
		ans.change(begin_index,end_index-1,i1->position);
	}
	for(ll i1=0;i1<q;i1++){
		cout<<ans.get(i1)<<endl;
	}
}


Measured memory_bytes: 21100